Class: GeonamesClient::NearbyStreet

Inherits:
Object
  • Object
show all
Defined in:
lib/geonames_client/nearby_street.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ NearbyStreet

Returns a new instance of NearbyStreet.



6
7
8
# File 'lib/geonames_client/nearby_street.rb', line 6

def initialize( options )
  @name = options[:name]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/geonames_client/nearby_street.rb', line 4

def name
  @name
end

Class Method Details

.all(*names) ⇒ Object



10
11
12
# File 'lib/geonames_client/nearby_street.rb', line 10

def self.all( *names )
  names.map { |name| NearbyStreet.new( :name => name ) }
end

Instance Method Details

#<=>(another_nearby_street) ⇒ Object



21
22
23
24
25
26
# File 'lib/geonames_client/nearby_street.rb', line 21

def <=>( another_nearby_street )
  return -1 if name < another_nearby_street.name
  return  1 if name > another_nearby_street.name

  0
end

#==(another_nearby_street) ⇒ Object



14
15
16
17
18
19
# File 'lib/geonames_client/nearby_street.rb', line 14

def ==( another_nearby_street )
  return false unless another_nearby_street.is_a?( NearbyStreet )
  return false unless another_nearby_street.name == name

  true
end