Class: Train::Extras::LinuxFile

Inherits:
UnixFile show all
Defined in:
lib/train/extras/file_linux.rb

Constant Summary

Constants inherited from FileCommon

FileCommon::DATA_FIELDS

Instance Attribute Summary

Attributes inherited from UnixFile

#path

Instance Method Summary collapse

Methods inherited from UnixFile

#exist?, #file_version, #initialize, #mounted, #product_version, #stat

Methods inherited from FileCommon

#basename, #block_device?, #character_device?, #directory?, #file?, #grouped_into?, #initialize, #link_path, #linked_to?, #md5sum, #mode?, #mounted?, #owned_by?, #pipe?, #sha256sum, #socket?, #source, #source_path, #symlink?, #to_json, #type, #unix_mode_mask, #version?

Constructor Details

This class inherits a constructor from Train::Extras::UnixFile

Instance Method Details

#contentObject



7
8
9
10
11
12
13
14
# File 'lib/train/extras/file_linux.rb', line 7

def content
  return @content if defined?(@content)
  @content = @backend.run_command(
    "cat #{@spath} || echo -n").stdout
  return @content unless @content.empty?
  @content = nil if directory? or size.nil? or size > 0
  @content
end