Class: FrenchMan::HashBuild

Inherits:
Object
  • Object
show all
Defined in:
lib/french_man.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ HashBuild

Returns a new instance of HashBuild.



40
41
42
# File 'lib/french_man.rb', line 40

def initialize(hash)
  @hash = hash || {}
end

Instance Method Details

#hashObject



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/french_man.rb', line 44

def hash
  result = {}
  @hash.each_pair do |key, value|
    key_string = key.to_s.capitalize
    if FrenchMan.const_defined? key_string
      blueprint = FrenchMan.const_get key_string
      result.merge! key => blueprint.plan(value)
    else
      result.merge! key => value
    end
  end
  ObjectifiedHash.new result
end