Permalink
Browse files

Make #attrs call methods if they exist

Closes #361.
  • Loading branch information...
1 parent 97a757c commit ff4f2daccd1acdfddcea7139d4dd6490b55129db @sferik committed Mar 8, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/twitter/base.rb
View
@@ -93,7 +93,9 @@ def [](method)
#
# @return [Hash]
def attrs
- @attrs
+ @attrs.inject({}) do |attrs, (key, value)|
+ attrs.merge!(key => respond_to?(key) ? send(key) : value)
+ end
end
alias to_hash attrs

0 comments on commit ff4f2da

Please sign in to comment.