Class: CallCenter::ConditionalStack::Conditional

Inherits:
Object
  • Object
show all
Defined in:
lib/call_center/conditional_stack.rb

Direct Known Subclasses

IfConditional, UnlessConditional

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Conditional

Returns a new instance of Conditional


33
34
35
# File 'lib/call_center/conditional_stack.rb', line 33

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


31
32
33
# File 'lib/call_center/conditional_stack.rb', line 31

def name
  @name
end

Instance Method Details

#evaluate(model) ⇒ Object


37
38
39
40
# File 'lib/call_center/conditional_stack.rb', line 37

def evaluate(model)
  result = model.send(@name)
  if? ? result : !result
end