Class: MatchMate::AddressMatchListItem

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/match-mate/address_match_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address_object_or_string, other_address) ⇒ AddressMatchListItem

Returns a new instance of AddressMatchListItem.



25
26
27
28
29
# File 'lib/match-mate/address_match_list.rb', line 25

def initialize(address_object_or_string, other_address)
  # Accepts any address object that responds to a to_s method
  @address = address_object_or_string
  @other_address = other_address
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



22
23
24
# File 'lib/match-mate/address_match_list.rb', line 22

def address
  @address
end

Instance Method Details

#<=>(other) ⇒ Object



35
36
37
# File 'lib/match-mate/address_match_list.rb', line 35

def <=>(other)
  other.score <=> score
end

#matcherObject



31
32
33
# File 'lib/match-mate/address_match_list.rb', line 31

def matcher
  @matcher ||= AddressMatcher.new(@address, @other_address)
end