Class: Train::Transports::Mock::Connection::File
- Defined in:
- lib/train/transports/mock.rb
Constant Summary
Constants inherited from File
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(backend, path, follow_symlink = true) ⇒ File
constructor
A new instance of File.
- #mounted ⇒ Object
Methods inherited from File
#block_device?, #character_device?, #directory?, #file?, #file_version, #md5sum, #mounted?, #owned_by?, #path, #pipe?, #product_version, #sanitize_filename, #sha256sum, #socket?, #source, #source_path, #symlink?, #to_json, #version?
Constructor Details
#initialize(backend, path, follow_symlink = true) ⇒ File
Returns a new instance of File.
166 167 168 169 170 |
# File 'lib/train/transports/mock.rb', line 166 def initialize(backend, path, follow_symlink = true) super(backend, path, follow_symlink) @type = :unknown @exist = false end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
164 165 166 |
# File 'lib/train/transports/mock.rb', line 164 def type @type end |
Class Method Details
.from_json(json) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/train/transports/mock.rb', line 144 def self.from_json(json) res = new(json['backend'], json['path'], json['follow_symlink']) res.type = json['type'] Train::File::DATA_FIELDS.each do |f| m = (f.tr('?', '') + '=').to_sym res.method(m).call(json[f]) end res end |
Instance Method Details
#mounted ⇒ Object
172 173 174 175 |
# File 'lib/train/transports/mock.rb', line 172 def mounted @mounted ||= @backend.run_command("mount | grep -- ' on #{@path}'") end |