Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Custom equalizer for Twitter::Place

  • Loading branch information...
commit 79c76a9bed4f0170c8c09fe38ad4f0ee6aa4505e 1 parent 1c93835
@sferik authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/twitter/place.rb
View
14 lib/twitter/place.rb
@@ -3,7 +3,6 @@
module Twitter
class Place < Twitter::Base
- include Equalizer.new(:woeid)
attr_reader :attributes, :country, :full_name, :name, :woeid
alias woe_id woeid
object_attr_reader :GeoFactory, :bounding_box
@@ -11,6 +10,19 @@ class Place < Twitter::Base
alias contained? contained_within?
uri_attr_reader :uri
+ # @param other [Twitter::Place]
+ # @return [Boolean]
+ def eql?(other)
+ super || instance_of?(other.class) && !woeid.nil? && other.respond_to?(:woeid) && woeid.eql?(other.woeid)
+ end
+
+ # @param other [Twitter::Place]
+ # @return [Boolean]
+ def ==(other)
+ other = coerce(other) if respond_to?(:coerce, true)
+ super || kind_of?(self.class) && !woeid.nil? && other.respond_to?(:woeid) && woeid == other.woeid
+ end
+
# @return [String]
def country_code
@attrs[:country_code] || @attrs[:countryCode]
Please sign in to comment.
Something went wrong with that request. Please try again.