Skip to content

Instantly share code, notes, and snippets.

@eladmeidar
Created July 19, 2009 01:13
Show Gist options
  • Save eladmeidar/149759 to your computer and use it in GitHub Desktop.
Save eladmeidar/149759 to your computer and use it in GitHub Desktop.
# in foo.rb
class Foo
attr_accessor :field1, :field2
def initialize(options => {})
@field1 = options[:field1] ||= nil
@field2 = options[:field2] ||= nil
end
end
f = Foo.new(:field1 => "value1", :field2 => "value2")
f.field1 # => "value1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment