Module: CamelTrail::YAMLUnsafeCoder

Defined in:
lib/camel_trail/yaml_unsafe_coder.rb

Class Method Summary collapse

Class Method Details

.dump(obj) ⇒ Object

Dumps the object to YAML.



19
20
21
# File 'lib/camel_trail/yaml_unsafe_coder.rb', line 19

def dump(obj)
  YAML.dump obj
end

.load(payload) ⇒ Object

Loads the object from YAML.



8
9
10
11
12
13
14
15
16
# File 'lib/camel_trail/yaml_unsafe_coder.rb', line 8

def load(payload)
  return unless payload

  if YAML.respond_to?(:unsafe_load)
    YAML.unsafe_load(payload)
  else
    YAML.load(payload) # rubocop:disable Security/YAMLLoad
  end
end