Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Make #attrs call methods if they exist"

This reverts commit ff4f2da.
  • Loading branch information...
commit 8b5fc9d4c0f6d277fc8dc0d416a513f2f5546d3e 1 parent de8a356
@sferik authored
Showing with 1 addition and 12 deletions.
  1. +1 −7 lib/twitter/base.rb
  2. +0 −5 spec/twitter/base_spec.rb
View
8 lib/twitter/base.rb
@@ -93,13 +93,7 @@ def [](method)
#
# @return [Hash]
def attrs
- @attrs.inject({}) do |attrs, (key, value)|
- if value.respond_to?(:attrs)
- attrs.merge!(key => value.attrs)
- else
- attrs.merge!(key => respond_to?(key) && method(key).arity.zero? ? send(key) : value)
- end
- end
+ @attrs
end
alias to_hash attrs
View
5 spec/twitter/base_spec.rb
@@ -112,11 +112,6 @@
it 'returns a hash of attributes' do
expect(Twitter::Base.new(:id => 1).attrs).to eq({:id => 1})
end
-
- it 'converts nested classes' do
- base = Twitter::Base.new(:id => 2, :user => Twitter::User.new(:id => 4))
- expect(base.attrs).to eq({:id => 2, :user => {:id => 4}})
- end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.