module Timecop

Extended Modules

Defined in:

timecop.cr
timecop/exceptions.cr
timecop/time_stack_item.cr
timecop/version.cr

Constant Summary

VERSION = "0.5.0"

Class Method Summary

Instance Method Summary

Class Method Detail

def self.safe_mode=(safe_mode) #

[View source]
def self.safe_mode? #

[View source]

Instance Method Detail

def freeze(time : Time) : Time #

Allows you to run a block of code and "fake" a time throughout the execution of that block.


[View source]
def freeze(time : Time, & : Time -> V) : V forall V #

Allows you to run a block of code and "fake" a time throughout the execution of that block.


[View source]
def frozen? : Bool #

Returns whether or not Timecop is currently frozen/travelled/scaled


[View source]
def return : Nil #

Reverts back to system's Time.local


[View source]
def return(& : -> V) : V forall V #

Reverts back to system's Time.local


[View source]
def scale(time : Time, factor : Float64) : Time #

Allows you to run a block of code and "scale" a time throughout the execution of that block.

Timecop.scale(2) do
  # ... time will 'go' twice as fast here
end

Returns the value of the block if one is given, or the mocked time.


[View source]
def scale(factor : Float64) : Time #

Allows you to run a block of code and "scale" a time throughout the execution of that block.

Timecop.scale(2) do
  # ... time will 'go' twice as fast here
end

Returns the value of the block if one is given, or the mocked time.


[View source]
def scale(time : Time, factor : Float64, & : Time -> V) forall V #

Allows you to run a block of code and "scale" a time throughout the execution of that block.

Timecop.scale(2) do
  # ... time will 'go' twice as fast here
end

Returns the value of the block if one is given, or the mocked time.


[View source]
def scale(factor : Float64, & : Time -> V) : V forall V #

Allows you to run a block of code and "scale" a time throughout the execution of that block.

Timecop.scale(2) do
  # ... time will 'go' twice as fast here
end

Returns the value of the block if one is given, or the mocked time.


[View source]
def travel(time : Time) : Time #

Allows you to run a block of code and "fake" a time throughout the execution of that block.


[View source]
def travel(time : Time, & : Time -> V) : V forall V #

Allows you to run a block of code and "fake" a time throughout the execution of that block.


[View source]