Module: Yamlable

Defined in:
lib/yamlable.rb,
lib/yamlable/version.rb

Overview

Adds to_yaml method to your Objects:

class Example
  include Yamlable
  ...

Constant Summary collapse

VERSION =
'0.0.2'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_yaml(yaml) ⇒ Object



15
16
17
# File 'lib/yamlable.rb', line 15

def self.from_yaml(yaml)
  Psych.load(yaml)
end

Instance Method Details

#to_yamlObject



11
12
13
# File 'lib/yamlable.rb', line 11

def to_yaml
  Psych.dump(self)
end