Class: Evertils::Common::Converter::YamlToEnml

Inherits:
Base
  • Object
show all
Defined in:
lib/evertils/common/converter/yaml_to_enml.rb

Overview

Since:

  • 0.3.0

Instance Method Summary collapse

Methods inherited from Generic

#bytesize, #deprecation_notice, #encoding, #force_encoding, #has_required_fields, #initialize

Constructor Details

This class inherits a constructor from Evertils::Common::Generic

Instance Method Details

#from_file(path) ⇒ Object

Since:

  • 0.2.9



8
9
10
11
12
13
# File 'lib/evertils/common/converter/yaml_to_enml.rb', line 8

def from_file(path)
  contents = File.open(path, "rb") { |io| io.read }
  obj = YAML::load(contents)

  builder(obj)
end

#from_string(yaml) ⇒ Object

Since:

  • 0.2.9



17
18
19
20
21
# File 'lib/evertils/common/converter/yaml_to_enml.rb', line 17

def from_string(yaml)
  obj = YAML::load(yaml)

  builder(obj)
end