Skip to content

Instantly share code, notes, and snippets.

@dnch
Created March 9, 2011 22:11
Show Gist options
  • Save dnch/863123 to your computer and use it in GitHub Desktop.
Save dnch/863123 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
class Foo
attr_accessor :bar, :baz, :florp
def initialize(properties = {})
properties.each do |key, value|
self.send("#{key}=", value)
end
end
end
foo = Foo.new(:bar => "rab", :baz => "zab")
puts "foo.bar: #{foo.bar}"
puts "foo.baz: #{foo.baz}"
puts "foo.florp: #{foo.florp}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment