Module: Brick::Serializers::YAML

Extended by:
YAML
Included in:
YAML
Defined in:
lib/brick/serializers/yaml.rb

Overview

The default serializer for, e.g. ‘versions.object`.

Instance Method Summary collapse

Instance Method Details

#dump(object) ⇒ Object



15
16
17
# File 'lib/brick/serializers/yaml.rb', line 15

def dump(object)
  ::YAML.dump object
end

#load(string) ⇒ Object



11
12
13
# File 'lib/brick/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/brick/serializers/yaml.rb', line 21

def where_object_condition(arel_field, field, value)
  arel_field.matches("%\n#{field}: #{value}\n%")
end