Class: Dynflow::ClockReference

Inherits:
Concurrent::Actor::Reference
  • Object
show all
Includes:
Algebrick::Types
Defined in:
lib/dynflow/clock.rb

Instance Method Summary collapse

Instance Method Details

#current_timeObject



113
114
115
# File 'lib/dynflow/clock.rb', line 113

def current_time
  Time.now
end

#ping(who, time, with_what = nil, where = :<<, optional: false) ⇒ Object



117
118
119
120
121
122
123
124
125
126
# File 'lib/dynflow/clock.rb', line 117

def ping(who, time, with_what = nil, where = :<<, optional: false)
  Type! time, Time, Numeric
  time = current_time + time if time.is_a? Numeric
  if who.is_a?(Action::Suspended)
    who.plan_event(with_what, time, optional: optional)
  else
    timer = Clock::Timer[who, time, with_what.nil? ? Algebrick::Types::None : Some[Object][with_what], where]
    self.tell([:add_timer, timer])
  end
end