Module: DutyFree::Serializers::YAML
Overview
The default serializer for, e.g. ‘versions.object`.
Instance Method Summary collapse
- #dump(object) ⇒ Object
- #load(string) ⇒ Object
-
#where_object_condition(arel_field, field, value) ⇒ Object
Returns a SQL LIKE condition to be used to match the given field and value in the serialized object.
Instance Method Details
#dump(object) ⇒ Object
15 16 17 |
# File 'lib/duty_free/serializers/yaml.rb', line 15 def dump(object) ::YAML.dump object end |
#load(string) ⇒ Object
11 12 13 |
# File 'lib/duty_free/serializers/yaml.rb', line 11 def load(string) ::YAML.safe_load string end |
#where_object_condition(arel_field, field, value) ⇒ Object
Returns a SQL LIKE condition to be used to match the given field and value in the serialized object.
21 22 23 |
# File 'lib/duty_free/serializers/yaml.rb', line 21 def where_object_condition(arel_field, field, value) arel_field.matches("%\n#{field}: #{value}\n%") end |