Class: RFlow::Components::Clock
- Inherits:
-
RFlow::Component
- Object
- RFlow::Component
- RFlow::Components::Clock
- Defined in:
- lib/rflow/components/clock.rb
Defined Under Namespace
Modules: Tick
Constant Summary collapse
- DEFAULT_CONFIG =
{ 'name' => 'Clock', 'tick_interval' => 1 }
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#tick_interval ⇒ Object
readonly
Returns the value of attribute tick_interval.
Attributes inherited from RFlow::Component
Instance Method Summary collapse
Methods inherited from RFlow::Component
build, #cleanup!, #configure_input_port!, #configure_output_port!, #connect_inputs!, #connect_outputs!, define_port, defined_input_ports, defined_output_ports, inherited, #initialize, input_port, #input_ports, output_port, #output_ports, #process_message, #shard, #shutdown!, #to_s
Constructor Details
This class inherits a constructor from RFlow::Component
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
28 29 30 |
# File 'lib/rflow/components/clock.rb', line 28 def config @config end |
#tick_interval ⇒ Object (readonly)
Returns the value of attribute tick_interval.
28 29 30 |
# File 'lib/rflow/components/clock.rb', line 28 def tick_interval @tick_interval end |
Instance Method Details
#clock_name ⇒ Object
35 |
# File 'lib/rflow/components/clock.rb', line 35 def clock_name; config['name']; end |
#configure!(config) ⇒ Object
30 31 32 33 |
# File 'lib/rflow/components/clock.rb', line 30 def configure!(config) @config = DEFAULT_CONFIG.merge config @tick_interval = Float(@config['tick_interval']) end |
#run! ⇒ Object
37 38 39 |
# File 'lib/rflow/components/clock.rb', line 37 def run! @timer = EventMachine::PeriodicTimer.new(tick_interval) { tick } end |