Class: Natour::Station
- Inherits:
-
Object
- Object
- Natour::Station
- Includes:
- Comparable
- Defined in:
- lib/natour/station.rb
Instance Attribute Summary collapse
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(label, type, distance) ⇒ Station
constructor
A new instance of Station.
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
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
5 6 7 |
# File 'lib/natour/station.rb', line 5 def distance @distance end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
3 4 5 |
# File 'lib/natour/station.rb', line 3 def label @label end |
#type ⇒ Object (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 |
#hash ⇒ Object
20 21 22 |
# File 'lib/natour/station.rb', line 20 def hash [@label, @type, @distance].hash end |