Class: Dialers::ShortCircuit

Inherits:
Object
  • Object
show all
Defined in:
lib/dialers/short_circuit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(condition, action) ⇒ 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

#actionObject

Returns the value of attribute action


16
17
18
# File 'lib/dialers/short_circuit.rb', line 16

def action
  @action
end

#conditionObject

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