Skip to content

Instantly share code, notes, and snippets.

@takano32
Created November 18, 2009 11:45
Show Gist options
  • Select an option

  • Save takano32/237763 to your computer and use it in GitHub Desktop.

Select an option

Save takano32/237763 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
class Hoge
def initialize(h)
h.each do |k,v|
eval("@#{k} = #{v}")
end
end
def print
puts @a
puts @b
end
end
hoge = Hoge.new({'a' => 1, 'b' => 2})
hoge.print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment