Class: TimeBoots::Jump

Inherits:
Object
  • Object
show all
Defined in:
lib/time_boots/jump.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step, amount) ⇒ Jump

Returns a new instance of Jump.



4
5
6
7
# File 'lib/time_boots/jump.rb', line 4

def initialize(step, amount)
  @step, @amount = step, amount
  @boot = Boot.get(step)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



9
10
11
# File 'lib/time_boots/jump.rb', line 9

def amount
  @amount
end

#stepObject (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

#inspectObject



26
27
28
# File 'lib/time_boots/jump.rb', line 26

def inspect
  '#<%s(%s): %+i>' % [self.class, step, amount]
end