Class: Chrono::Trigger
- Inherits:
-
Object
- Object
- Chrono::Trigger
- Defined in:
- lib/chrono/trigger.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source, &block) ⇒ Trigger
constructor
A new instance of Trigger.
- #once ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(source, &block) ⇒ Trigger
Returns a new instance of Trigger.
5 6 7 8 |
# File 'lib/chrono/trigger.rb', line 5 def initialize(source, &block) @source = source @block = block || -> {} end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
3 4 5 |
# File 'lib/chrono/trigger.rb', line 3 def block @block end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/chrono/trigger.rb', line 3 def source @source end |
Instance Method Details
#once ⇒ Object
10 11 12 13 |
# File 'lib/chrono/trigger.rb', line 10 def once wait call end |
#run ⇒ Object
15 16 17 |
# File 'lib/chrono/trigger.rb', line 15 def run loop { once } end |