Class: KingKong::Runner::DSL::Pinger
- Inherits:
-
Object
- Object
- KingKong::Runner::DSL::Pinger
- Defined in:
- lib/kingkong/runner.rb
Overview
Encapsulate the configuration of a bunch of pingers that we can run in one KingKong file
Defined Under Namespace
Modules: Unit
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
Instance Method Summary collapse
-
#completed(&block) ⇒ Object
Callback when we’ve completed the configuration of this thing.
-
#duration ⇒ Object
The number of seconds the timer will wait between ticks.
- #every(quantity) ⇒ Object
-
#hours(&block) ⇒ Object
(also: #hour)
Configure the ping duration as hours.
-
#minutes(&block) ⇒ Object
(also: #minute)
Configure the duration as minutes.
-
#pinger ⇒ Object
Return a configured instance of a pinger that we can fire up and do stuff with.
-
#seconds(&block) ⇒ Object
(also: #second)
Configure duration as seconds.
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
85 86 87 |
# File 'lib/kingkong/runner.rb', line 85 def block @block end |
Instance Method Details
#completed(&block) ⇒ Object
Callback when we’ve completed the configuration of this thing.
124 125 126 127 |
# File 'lib/kingkong/runner.rb', line 124 def completed(&block) @completed_blk = block self end |
#duration ⇒ Object
The number of seconds the timer will wait between ticks. We’ll pass this into EM
114 115 116 |
# File 'lib/kingkong/runner.rb', line 114 def duration @units * @quantity end |
#every(quantity) ⇒ Object
87 88 89 90 |
# File 'lib/kingkong/runner.rb', line 87 def every(quantity) @quantity = quantity self end |
#hours(&block) ⇒ Object Also known as: hour
Configure the ping duration as hours
107 108 109 110 |
# File 'lib/kingkong/runner.rb', line 107 def hours(&block) unitize Unit::Hour, &block complete end |
#minutes(&block) ⇒ Object Also known as: minute
Configure the duration as minutes
100 101 102 103 |
# File 'lib/kingkong/runner.rb', line 100 def minutes(&block) unitize Unit::Minute, &block complete end |