Class: Levels::Output::YAML

Inherits:
Object
  • Object
show all
Defined in:
lib/levels/output/yaml.rb

Instance Method Summary collapse

Instance Method Details

#generate(enumerator) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/levels/output/yaml.rb', line 5

def generate(enumerator)
  hash = {}
  enumerator.each do |group_name, group|
    hash[group_name.to_s] = {}
    group.each do |key, value|
      hash[group_name.to_s][key.to_s] = value
    end
  end
  ::YAML.dump(hash)
end