lib/twitter/base.rb in twitter-5.4.1 vs lib/twitter/base.rb in twitter-5.5.0

- old
+ new

@@ -71,11 +71,11 @@ # # @param key1 [Symbol] # @param key2 [Symbol] def define_uri_method(key1, key2) define_method(key1) do || - Addressable::URI.parse(@attrs[key2]) if @attrs[key2] + Addressable::URI.parse(@attrs[key2]) unless @attrs[key2].nil? end memoize(key1) end # Dynamically define a method for an attribute @@ -86,14 +86,14 @@ def define_attribute_method(key1, klass = nil, key2 = nil) define_method(key1) do || if klass.nil? @attrs[key1] else - if @attrs[key1] + if @attrs[key1].nil? + NullObject.new + else attrs = attrs_for_object(key1, key2) Twitter.const_get(klass).new(attrs) - else - NullObject.new end end end memoize(key1) end