Class: Timetastic::Traveller
- Inherits:
-
Object
- Object
- Timetastic::Traveller
- Defined in:
- lib/timetastic.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
Instance Method Summary collapse
-
#initialize(direction, distance, relative_to = nil) ⇒ Traveller
constructor
A new instance of Traveller.
Constructor Details
#initialize(direction, distance, relative_to = nil) ⇒ Traveller
Returns a new instance of Traveller.
66 67 68 69 70 71 72 73 |
# File 'lib/timetastic.rb', line 66 def initialize(direction, distance, relative_to = nil) @distance = distance.to_i @relative_to = relative_to @direction = case direction when -1; :ago when 1; :hence end end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
64 65 66 |
# File 'lib/timetastic.rb', line 64 def direction @direction end |
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
64 65 66 |
# File 'lib/timetastic.rb', line 64 def distance @distance end |