Class: Train::File::Remote::Linux

Inherits:
Unix show all
Defined in:
lib/train/file/remote/linux.rb

Constant Summary

Constants inherited from Train::File

DATA_FIELDS

Instance Method Summary collapse

Methods inherited from Unix

#content=, #exist?, #grouped_into?, #link_path, #linked_to?, #mode?, #mounted, #path, #sanitize_filename, #shallow_link_path, #unix_mode_mask

Methods inherited from Train::File::Remote

#basename, #stat

Methods inherited from Train::File

#block_device?, #character_device?, #directory?, #file?, #file_version, #initialize, #md5sum, #mounted?, #owned_by?, #path, #pipe?, #product_version, #sanitize_filename, #sha256sum, #socket?, #source, #source_path, #symlink?, #to_json, #type, #version?

Constructor Details

This class inherits a constructor from Train::File

Instance Method Details

#contentObject



7
8
9
10
11
12
13
14
15
# File 'lib/train/file/remote/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? || size.nil? || (size > 0)
  @content
end