Method: Dilation::Core#contract

Defined in:
lib/dilation/core.rb

#contractNumber #contract(factor) ⇒ Number

Speeds up (contracts) time for your code

Examples:

Run at 2x time

core.contract(2)
core.tick #=> fires 2 tick events

Overloads:

  • #contractNumber

    Sets a factor of 1 which is the same as no contraction

  • #contract(factor) ⇒ Number

    Sets a factor of factor which implies factor ‘Core#tick`s

    per one `Core#timer` tick
    

    Parameters:

    • factor (Number)

      the contraction factor

Returns:

  • (Number)

    the contraction factor

See Also:



57
58
59
60
61
# File 'lib/dilation/core.rb', line 57

def contract(factor = 1)
  @dilator.factor = factor
  @dilator.uninvert
  factor
end