lib/nanoc/base/entities/context.rb in nanoc-4.4.4 vs lib/nanoc/base/entities/context.rb in nanoc-4.4.5
- old
+ new
@@ -22,15 +22,12 @@
# context.instance_eval do
# "I am #{name} and I am hiding #{@location}."
# end
# # => "I am Max Payne and I am hiding in a cheap motel."
def initialize(hash)
+ metaclass = class << self; self; end
hash.each_pair do |key, value|
- # Build instance variable
instance_variable_set('@' + key.to_s, value)
-
- # Define method
- metaclass = (class << self; self; end)
metaclass.send(:define_method, key) { value }
end
end
# Returns a binding for this instance.