class Rets::Metadata::JsonSerializer

Serialize/Deserialize metadata using JSON.

Public Instance Methods

load(file) click to toggle source

Deserialize from a file. If the metadata cannot be deserialized, return nil.

# File lib/rets/metadata/json_serializer.rb, line 18
def load(file)
  JSON.load(file)
rescue JSON::ParserError
  nil
end
save(file, o) click to toggle source

Serialize to a file. The library reserves the right to change the type or contents of o, so don't depend on it being anything in particular.

# File lib/rets/metadata/json_serializer.rb, line 12
def save(file, o)
  file.write o.to_json
end