Method: WhatTheGem::Hobject#initialize

Defined in:
lib/whatthegem/hobject.rb

#initialize(hash) ⇒ Hobject

Returns a new instance of Hobject.



22
23
24
25
26
27
28
# File 'lib/whatthegem/hobject.rb', line 22

def initialize(hash)
  @hash = hash.transform_keys(&:to_sym).freeze
  @hash.each do |key, val|
    define_singleton_method(key) { val }
    define_singleton_method("#{key}?") { !!val }
  end
end