Skip to content

Commit

Permalink
Deprecate to_hash/to_hsh in favor of to_h or attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Jan 13, 2014
1 parent ac24671 commit 63e2cdd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
6 changes: 4 additions & 2 deletions lib/twitter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lib/twitter/cursor.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions lib/twitter/geo_results.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions lib/twitter/search_results.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 5 additions & 3 deletions lib/twitter/trend_results.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 63e2cdd

Please sign in to comment.