Module: Cerealize::Codec::Yaml

Defined in:
lib/cerealize/codec/yaml.rb

Class Method Summary collapse

Class Method Details

.decode(str) ⇒ Object



16
17
18
# File 'lib/cerealize/codec/yaml.rb', line 16

def decode(str)
  YAML.load(str)
end

.encode(obj) ⇒ Object



12
13
14
# File 'lib/cerealize/codec/yaml.rb', line 12

def encode(obj)
  YAML.dump(obj)
end

.yours?(str) ⇒ Boolean

See YAML spec (though might fail if "directives"?)



8
9
10
# File 'lib/cerealize/codec/yaml.rb', line 8

def yours?(str)
  str[0..2] == '---'
end