Skip to content

Commit

Permalink
Symbolize inbound keys on Dash, update README, ignore .gemspec since …
Browse files Browse the repository at this point in the history
…GitHub doesn't build gems anymore.
  • Loading branch information
Michael Bleigh committed Nov 12, 2009
1 parent 14ea3cf commit 6b5d126
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@
coverage
rdoc
pkg
/hashie.gemspec
9 changes: 5 additions & 4 deletions README.rdoc
Expand Up @@ -50,13 +50,14 @@ can set defaults for each property.
property :email
property :occupation, :default => 'Rubyist'
end

p = Person.new
p.name # => nil
p.occupation # => 'Rubyist'
p.email = 'abc@def.com'
p.email # => 'abc@def.com'
p['awesome'] # => NoMethodError
p.occupation # => 'Rubyist'
p.email # => 'abc@def.com'
p[:awesome] # => NoMethodError
p[:occupation] # => 'Rubyist'


== Note on Patches/Pull Requests
Expand Down
2 changes: 1 addition & 1 deletion lib/hashie/dash.rb
Expand Up @@ -56,7 +56,7 @@ def self.defaults
# Retrieve a value from the Dash (will return the
# property's default value if it hasn't been set).
def [](property_name)
super || self.class.defaults[property_name.to_sym]
super(property_name.to_sym) || self.class.defaults[property_name.to_sym]
end

# Set a value on the Dash in a Hash-like way. Only works
Expand Down

0 comments on commit 6b5d126

Please sign in to comment.