Method: Musa::Clock::DummyClock#initialize

Defined in:
lib/musa-dsl/transport/dummy-clock.rb

#initialize(ticks = nil, do_log: nil) { ... } ⇒ DummyClock

Note:

Only one of ticks or block should be provided

Creates a new dummy clock with tick limit or condition.

Parameters:

  • ticks (Integer, nil) (defaults to: nil)

    number of ticks to generate (mutually exclusive with block)

  • do_log (Boolean, nil) (defaults to: nil)

    enable logging

Yields:

  • Condition block called each iteration; runs while truthy

Raises:

  • (ArgumentError)

    if both ticks and block are provided



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/musa-dsl/transport/dummy-clock.rb', line 66

def initialize(ticks = nil, do_log: nil, &block)
  do_log ||= false

  super()

  raise ArgumentError, 'Cannot initialize with ticks and block. You can only use one of the parameters.' if ticks && block

  @ticks = ticks
  @do_log = do_log
  @block = block
end