Created
July 19, 2009 01:13
-
-
Save eladmeidar/149759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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