Permalink
Browse files

Deprecate to_hash/to_hsh in favor of to_h or attrs

  • Loading branch information...
1 parent ac24671 commit 63e2cdd693aece2912564988d06786cd23a2cad5 @sferik committed Jan 13, 2014
Showing with 21 additions and 11 deletions.
  1. +4 −2 lib/twitter/base.rb
  2. +4 −2 lib/twitter/cursor.rb
  3. +4 −2 lib/twitter/geo_results.rb
  4. +4 −2 lib/twitter/search_results.rb
  5. +5 −3 lib/twitter/trend_results.rb
View
@@ -2,15 +2,17 @@
require 'forwardable'
require 'memoizable'
require 'twitter/null_object'
+require 'twitter/utils'
module Twitter
class Base
extend Forwardable
include Memoizable
+ include Twitter::Utils
attr_reader :attrs
alias_method :to_h, :attrs
- alias_method :to_hash, :attrs
- alias_method :to_hsh, :attrs
+ deprecate_alias :to_hash, :to_h
+ deprecate_alias :to_hsh, :to_h
class << self
# Construct an object from a response hash
View
@@ -1,12 +1,14 @@
require 'twitter/enumerable'
+require 'twitter/utils'
module Twitter
class Cursor
include Twitter::Enumerable
+ include Twitter::Utils
attr_reader :attrs
alias_method :to_h, :attrs
- alias_method :to_hash, :attrs
- alias_method :to_hsh, :attrs
+ deprecate_alias :to_hash, :to_h
+ deprecate_alias :to_hsh, :to_h
class << self
# Construct a new Cursor object from a response hash
@@ -1,12 +1,14 @@
require 'twitter/enumerable'
+require 'twitter/utils'
module Twitter
class GeoResults
include Twitter::Enumerable
+ include Twitter::Utils
attr_reader :attrs
alias_method :to_h, :attrs
- alias_method :to_hash, :attrs
- alias_method :to_hsh, :attrs
+ deprecate_alias :to_hash, :to_h
+ deprecate_alias :to_hsh, :to_h
class << self
# Construct a new GeoResults object from a response hash
@@ -1,12 +1,14 @@
require 'twitter/enumerable'
+require 'twitter/utils'
module Twitter
class SearchResults
include Twitter::Enumerable
+ include Twitter::Utils
attr_reader :attrs
alias_method :to_h, :attrs
- alias_method :to_hash, :attrs
- alias_method :to_hsh, :attrs
+ deprecate_alias :to_hash, :to_h
+ deprecate_alias :to_hsh, :to_h
class << self
# Construct a new SearchResults object from a response hash
@@ -1,17 +1,19 @@
+require 'memoizable'
require 'twitter/creatable'
require 'twitter/enumerable'
-require 'memoizable'
require 'twitter/null_object'
+require 'twitter/utils'
module Twitter
class TrendResults
include Twitter::Creatable
include Twitter::Enumerable
+ include Twitter::Utils
include Memoizable
attr_reader :attrs
alias_method :to_h, :attrs
- alias_method :to_hash, :attrs
- alias_method :to_hsh, :attrs
+ deprecate_alias :to_hash, :to_h
+ deprecate_alias :to_hsh, :to_h
class << self
# Construct a new TrendResults object from a response hash

0 comments on commit 63e2cdd

Please sign in to comment.