module HashExtensions
Public Instance Methods
to_instance_variables(bind, opts={})
click to toggle source
experiment to make hash arguments into instance variables
# File lib/benchmark_time/hash_extensions.rb, line 4 def to_instance_variables(bind, opts={}) each do |key, val| bind.eval("@#{key}=#{val.inspect}") # we can build attr_accessor, attr_reader, attr_writers off these options # bind.eval "self.class.class_eval 'attr_reader :foo'"if opts[:define] end end