Skip to content

Commit

Permalink
Un-deprecate Twitter::Base#to_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Jun 24, 2014
1 parent 005259c commit f45ce59
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* [Remove unused methods `#put` and `#delete` in `Twitter::REST::Client`](https://github.com/sferik/twitter/commit/eaaf234b84a6e2e1f7695f73befaf11f30664f4a)
* [Deprecate `retweeters_count` in favor of `retweet_count`](https://github.com/sferik/twitter/commit/ea39bd013364dc24f02e9a1eb25b4b48b99a5480)
* [Deprecate `favorites_count`/`favoriters_count` in favor of `favorite_count`](https://github.com/sferik/twitter/commit/ea39bd013364dc24f02e9a1eb25b4b48b99a5480)
* [Deprecate `to_hash`/`to_hsh` in favor of `to_h` or `attrs`](https://github.com/sferik/twitter/commit/63e2cdd693aece2912564988d06786cd23a2cad5)
* [Deprecate `to_hsh` in favor of `to_hash` or `attrs`](https://github.com/sferik/twitter/commit/63e2cdd693aece2912564988d06786cd23a2cad5)
* [Deprecate `oauth_token` and `oauth_token_secret` accessors](https://github.com/sferik/twitter/commit/ac246717557ea02565a1d93b3f9a975e7fd39874)

5.5.1
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class Base
# @return [Hash]
attr_reader :attrs
alias_method :to_h, :attrs
deprecate_alias :to_hash, :to_h
deprecate_alias :to_hsh, :to_h
alias_method :to_hash, :to_h
deprecate_alias :to_hsh, :to_hash

class << self
# Define methods that retrieve the value from attributes
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/cursor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class Cursor
# @return [Hash]
attr_reader :attrs
alias_method :to_h, :attrs
deprecate_alias :to_hash, :to_h
deprecate_alias :to_hsh, :to_h
alias_method :to_hash, :to_h
deprecate_alias :to_hsh, :to_hash

# Initializes a new Cursor
#
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/geo_results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class GeoResults
# @return [Hash]
attr_reader :attrs
alias_method :to_h, :attrs
deprecate_alias :to_hash, :to_h
deprecate_alias :to_hsh, :to_h
alias_method :to_hash, :to_h
deprecate_alias :to_hsh, :to_hash

# Initializes a new GeoResults object
#
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/search_results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class SearchResults
# @return [Hash]
attr_reader :attrs
alias_method :to_h, :attrs
deprecate_alias :to_hash, :to_h
deprecate_alias :to_hsh, :to_h
alias_method :to_hash, :to_h
deprecate_alias :to_hsh, :to_hash

# Initializes a new SearchResults object
#
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/trend_results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class TrendResults
# @return [Hash]
attr_reader :attrs
alias_method :to_h, :attrs
deprecate_alias :to_hash, :to_h
deprecate_alias :to_hsh, :to_h
alias_method :to_hash, :to_h
deprecate_alias :to_hsh, :to_hash

# Initializes a new TrendResults object
#
Expand Down
6 changes: 3 additions & 3 deletions spec/twitter/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@
end
end

describe '#to_hash' do
describe '#to_hsh' do
it 'outputs a warning' do
warning = capture_warning do
expect(@base.to_hash).to eq(:id => 1)
expect(@base.to_hsh).to eq(:id => 1)
end
expect(warning).to match(/\[DEPRECATION\] #to_hash is deprecated\. Use #to_h instead\./)
expect(warning).to match(/\[DEPRECATION\] #to_hsh is deprecated\. Use #to_hash instead\./)
end
end
end

0 comments on commit f45ce59

Please sign in to comment.