Method: Train::Transports::Mock::Connection::File.from_json

Defined in:
lib/train/transports/mock.rb

.from_json(json) ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
# File 'lib/train/transports/mock.rb', line 150

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