Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Restore to_hash

  • Loading branch information...
commit 13d95f0867cde190b729c3f78934ed6ee979dc33 1 parent a8c96d9
@sferik authored
View
2  lib/twitter/status.rb
@@ -55,7 +55,7 @@ def urls
end
def user
- @user ||= Twitter::User.new(@attributes['user']) unless @attributes['user'].nil?
+ @user ||= Twitter::User.new(@attributes['user'].merge('status' => self.to_hash.delete_if{|key, value| key == 'user'})) unless @attributes['user'].nil?
end
def user_mentions
View
2  lib/twitter/user.rb
@@ -54,7 +54,7 @@ def ==(other)
end
def status
- @status ||= Twitter::Status.new(@attributes['status']) unless @attributes['status'].nil?
+ @status ||= Twitter::Status.new(@attributes['status'].merge('user' => self.to_hash.delete_if{|key, value| key == 'status'})) unless @attributes['status'].nil?
end
end
View
7 spec/twitter/base_spec.rb
@@ -15,4 +15,11 @@
end
end
+ describe "#to_hash" do
+ it "should return a hash" do
+ @base.to_hash.should be_a Hash
+ @base.to_hash['id'].should == 1
+ end
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.