Class: Train::Transports::Mock::Connection::File
- Inherits:
-
FileCommon
- Object
- FileCommon
- Train::Transports::Mock::Connection::File
- Defined in:
- lib/train/transports/mock.rb
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
Constructor Details
#initialize(backend, path, follow_symlink = true) ⇒ File
Returns a new instance of File.
154 155 156 157 158 |
# File 'lib/train/transports/mock.rb', line 154 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.
152 153 154 |
# File 'lib/train/transports/mock.rb', line 152 def type @type end |
Class Method Details
.from_json(json) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/train/transports/mock.rb', line 132 def self.from_json(json) res = new(json['backend'], json['path'], json['follow_symlink']) res.type = json['type'] Train::Extras::FileCommon::DATA_FIELDS.each do |f| m = (f.tr('?', '') + '=').to_sym res.method(m).call(json[f]) end res end |
Instance Method Details
#mounted ⇒ Object
160 161 162 163 |
# File 'lib/train/transports/mock.rb', line 160 def mounted @mounted ||= @backend.run_command("mount | grep -- ' on #{@path}'") end |