Class: Proxy::Dynflow::Ticker
- Inherits:
-
Dynflow::Actor
- Object
- Dynflow::Actor
- Proxy::Dynflow::Ticker
- Defined in:
- lib/smart_proxy_dynflow/ticker.rb
Instance Attribute Summary collapse
-
#clock ⇒ Object
readonly
Returns the value of attribute clock.
Instance Method Summary collapse
- #add_event(target, args) ⇒ Object
-
#initialize(clock, logger, refresh_interval) ⇒ Ticker
constructor
A new instance of Ticker.
- #tick ⇒ Object
Constructor Details
#initialize(clock, logger, refresh_interval) ⇒ Ticker
7 8 9 10 11 12 13 |
# File 'lib/smart_proxy_dynflow/ticker.rb', line 7 def initialize(clock, logger, refresh_interval) @clock = clock @logger = logger @events = [] @refresh_interval = refresh_interval plan_next_tick end |
Instance Attribute Details
#clock ⇒ Object (readonly)
Returns the value of attribute clock.
5 6 7 |
# File 'lib/smart_proxy_dynflow/ticker.rb', line 5 def clock @clock end |
Instance Method Details
#add_event(target, args) ⇒ Object
26 27 28 29 |
# File 'lib/smart_proxy_dynflow/ticker.rb', line 26 def add_event(target, args) @events << [target, args] plan_next_tick end |
#tick ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/smart_proxy_dynflow/ticker.rb', line 15 def tick @logger.debug("Ticker ticking for #{@events.size} events") @events.each do |(target, args)| pass_event(target, args) end @events = [] ensure @planned = false plan_next_tick end |