Class: TimeBoots::Jump
- Inherits:
-
Object
- Object
- TimeBoots::Jump
- Defined in:
- lib/time_boots/jump.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#step ⇒ Object
readonly
Returns the value of attribute step.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #after(tm = Time.now) ⇒ Object (also: #from)
- #before(tm = Time.now) ⇒ Object (also: #ago)
-
#initialize(step, amount) ⇒ Jump
constructor
A new instance of Jump.
- #inspect ⇒ Object
Constructor Details
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
9 10 11 |
# File 'lib/time_boots/jump.rb', line 9 def amount @amount end |
#step ⇒ Object (readonly)
Returns the value of attribute step.
9 10 11 |
# File 'lib/time_boots/jump.rb', line 9 def step @step end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 |
# File 'lib/time_boots/jump.rb', line 22 def ==(other) step == other.step && amount == other.amount end |
#after(tm = Time.now) ⇒ Object Also known as: from
15 16 17 |
# File 'lib/time_boots/jump.rb', line 15 def after(tm = Time.now) @boot.advance(tm, amount) end |
#before(tm = Time.now) ⇒ Object Also known as: ago
11 12 13 |
# File 'lib/time_boots/jump.rb', line 11 def before(tm = Time.now) @boot.decrease(tm, amount) end |
#inspect ⇒ Object
26 27 28 |
# File 'lib/time_boots/jump.rb', line 26 def inspect '#<%s(%s): %+i>' % [self.class, step, amount] end |