class Effigie::HashBinding

The Effigie::HashBinding class provides provides a wrapper to define a Binding out of an Hash

Public Class Methods

new(hash) click to toggle source

Creates a new instance of Effigie::HashBinding

Params:

hash

Hash an hash

# File lib/effigie/hash_binding.rb, line 10
def initialize(hash)
  raise Effigie::Error.new("Effigie::HashBinding requires an Hash as argument.") unless hash.is_a?(Hash)
  hash.each do |key, value|
    singleton_class.send(:define_method, key) { value }
  end
end