Quickly setting instance variables with options hash in Ruby?
This should give you what you're looking for:
def initialize(opts={})
opts.each_pair do |key, value|
send("#{key}=",value)
end
end
def initialize(opts={})
opts.each { |k,v| instance_variable_set("@#{k}", v) }
end