Class: Rets::Metadata::YamlSerializer
- Inherits:
-
Object
- Object
- Rets::Metadata::YamlSerializer
- Defined in:
- lib/rets/metadata/yaml_serializer.rb
Overview
Serialize/Deserialize metadata using Marshal.
Instance Method Summary collapse
-
#load(file) ⇒ Object
Deserialize from a file.
-
#save(file, o) ⇒ Object
Serialize to a file.
Instance Method Details
#load(file) ⇒ Object
Deserialize from a file. If the metadata cannot be deserialized, return nil.
18 19 20 21 22 |
# File 'lib/rets/metadata/yaml_serializer.rb', line 18 def load(file) YAML.load(file) rescue Psych::SyntaxError nil end |
#save(file, o) ⇒ Object
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.
12 13 14 |
# File 'lib/rets/metadata/yaml_serializer.rb', line 12 def save(file, o) YAML.dump(o, file) end |