Class: Dialers::ShortCircuit
- Inherits:
-
Object
- Object
- Dialers::ShortCircuit
- Defined in:
- lib/dialers/short_circuit.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#condition ⇒ Object
Returns the value of attribute condition.
Instance Method Summary collapse
- #can_stop?(response) ⇒ Boolean
-
#initialize(condition, action) ⇒ ShortCircuit
constructor
A new instance of ShortCircuit.
- #stop(response) ⇒ Object
Constructor Details
#initialize(condition, action) ⇒ ShortCircuit
Returns a new instance of ShortCircuit.
3 4 5 6 |
# File 'lib/dialers/short_circuit.rb', line 3 def initialize(condition, action) self.condition = condition self.action = action end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
16 17 18 |
# File 'lib/dialers/short_circuit.rb', line 16 def action @action end |
#condition ⇒ Object
Returns the value of attribute condition.
16 17 18 |
# File 'lib/dialers/short_circuit.rb', line 16 def condition @condition end |
Instance Method Details
#can_stop?(response) ⇒ Boolean
8 9 10 |
# File 'lib/dialers/short_circuit.rb', line 8 def can_stop?(response) condition.call(response) end |
#stop(response) ⇒ Object
12 13 14 |
# File 'lib/dialers/short_circuit.rb', line 12 def stop(response) action.call(response) end |