Class: Train::Transports::Local::Connection::File
Constant Summary
Extras::FileCommon::DATA_FIELDS
Instance Method Summary
collapse
#exist?, #file_version, #initialize, #mounted, #product_version
#basename, #directory?, #file?, #grouped_into?, #initialize, #linked_to?, #md5sum, #mode?, #mounted?, #owned_by?, #pipe?, #sha256sum, #socket?, #source, #source_path, #symlink?, #to_json, #type, #unix_mode_mask, #version?
Instance Method Details
#block_device? ⇒ Boolean
42
43
44
|
# File 'lib/train/transports/local_file.rb', line 42
def block_device?
::File.blockdev?(@path)
end
|
#character_device? ⇒ Boolean
46
47
48
|
# File 'lib/train/transports/local_file.rb', line 46
def character_device?
::File.chardev?(@path)
end
|
#content ⇒ Object
10
11
12
13
14
|
# File 'lib/train/transports/local_file.rb', line 10
def content
@content ||= ::File.read(@path, encoding: 'UTF-8')
rescue StandardError => _
nil
end
|
#link_path ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/train/transports/local_file.rb', line 32
def link_path
return nil unless symlink?
begin
@link_path ||= ::File.realpath(@path)
rescue Errno::ELOOP => _
@link_path = ''
end
end
|
#path ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/train/transports/local_file.rb', line 24
def path
if symlink? && @follow_symlink
link_path
else
@path
end
end
|