Module: Zuck::HashDelegator::ClassMethods

Defined in:
lib/zuck/fb_object/hash_delegator.rb

Instance Method Summary collapse

Instance Method Details

#known_keys(*args) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/zuck/fb_object/hash_delegator.rb', line 50

def known_keys(*args)
  args.each do |key|

    # Define getter
    self.send(:define_method, key) do
      init_hash
      @hash_delegator_hash[key]
    end

    # Define setter
    self.send(:define_method, "#{key}=") do |val|
      init_hash
      @hash_delegator_hash[key] = val
    end
  end
end