Class: Natour::Station

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/natour/station.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, type, distance) ⇒ Station

Returns a new instance of Station.



7
8
9
10
11
# File 'lib/natour/station.rb', line 7

def initialize(label, type, distance)
  @label = label
  @type = type
  @distance = distance
end

Instance Attribute Details

#distanceObject (readonly)

Returns the value of attribute distance.



5
6
7
# File 'lib/natour/station.rb', line 5

def distance
  @distance
end

#labelObject (readonly)

Returns the value of attribute label.



3
4
5
# File 'lib/natour/station.rb', line 3

def label
  @label
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/natour/station.rb', line 4

def type
  @type
end

Instance Method Details

#<=>(other) ⇒ Object



15
16
17
18
# File 'lib/natour/station.rb', line 15

def <=>(other)
  [@label, @type, @distance] <=>
    [other.label, other.type, other.distance]
end

#hashObject



20
21
22
# File 'lib/natour/station.rb', line 20

def hash
  [@label, @type, @distance].hash
end