lib/twitter/base.rb in twitter-5.11.0 vs lib/twitter/base.rb in twitter-5.12.0
- old
+ new
@@ -7,14 +7,15 @@
module Twitter
class Base
extend Forwardable
include Memoizable
include Twitter::Utils
+ # @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
#
# @param attrs [Array, Symbol]
@@ -70,11 +71,11 @@
#
# @param key1 [Symbol]
# @param key2 [Symbol]
def define_uri_method(key1, key2)
define_method(key1) do ||
- Addressable::URI.parse(@attrs[key2]) unless @attrs[key2].nil?
+ Addressable::URI.parse(@attrs[key2].chomp('#')) unless @attrs[key2].nil?
end
memoize(key1)
end
# Dynamically define a method for an attribute
@@ -96,11 +97,9 @@
end
end
memoize(key1)
end
- # Dynamically define a method for an attribute
- #
# @param key [Symbol]
def deprecate_attribute_method(key)
define_method(key) do ||
warn "#{Kernel.caller.first}: [DEPRECATION] ##{key} is deprecated. Use ##{key}? instead."
@attrs[key]