lib/twitter/base.rb in twitter-5.15.0 vs lib/twitter/base.rb in twitter-5.16.0

- old
+ new

@@ -9,12 +9,12 @@ extend Forwardable include Memoizable include Twitter::Utils # @return [Hash] attr_reader :attrs - alias_method :to_h, :attrs - alias_method :to_hash, :to_h + alias to_h attrs + alias to_hash to_h deprecate_alias :to_hsh, :to_hash class << self # Define methods that retrieve the value from attributes # @@ -85,16 +85,14 @@ # @param key2 [Symbol] def define_attribute_method(key1, klass = nil, key2 = nil) define_method(key1) do || if attr_falsey_or_empty?(key1) NullObject.new + elsif klass.nil? + @attrs[key1] else - if klass.nil? - @attrs[key1] - else - attrs = attrs_for_object(key1, key2) - Twitter.const_get(klass).new(attrs) - end + attrs = attrs_for_object(key1, key2) + Twitter.const_get(klass).new(attrs) end end memoize(key1) end