Module: Consular::DSL::Yaml

Defined in:
lib/consular/dsl.rb

Overview

Contains interpretation for the legacy YAML format.

Instance Method Summary collapse

Instance Method Details

#to_hashHash

Returns yaml file as formmatted hash

Returns:

  • (Hash)

    Hash format of Termfile



202
203
204
205
206
207
208
209
210
# File 'lib/consular/dsl.rb', line 202

def to_hash
  @_file ||= {}
  combined = @_file.inject({}) do |base, item| 
    item = {item.keys.first => {:commands => item.values.first, :options => {}}}
    base.merge!(item)
    base
  end # merge the array of hashes.
   { :setup => nil, :windows => { 'default' => { :tabs => combined } } }
end