Class: Simplerubysteps::ChoiceItem
- Inherits:
-
Object
- Object
- Simplerubysteps::ChoiceItem
- Defined in:
- lib/simplerubysteps.rb
Instance Attribute Summary collapse
-
#implicit_condition_block ⇒ Object
Returns the value of attribute implicit_condition_block.
Instance Method Summary collapse
-
#initialize(dict = {}, state = nil) ⇒ ChoiceItem
constructor
A new instance of ChoiceItem.
- #next=(state) ⇒ Object
- #perform_action(choice_name, output) ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(dict = {}, state = nil) ⇒ ChoiceItem
Returns a new instance of ChoiceItem.
127 128 129 130 |
# File 'lib/simplerubysteps.rb', line 127 def initialize(dict = {}, state = nil) @dict = dict self.next = state if state end |
Instance Attribute Details
#implicit_condition_block ⇒ Object
Returns the value of attribute implicit_condition_block.
125 126 127 |
# File 'lib/simplerubysteps.rb', line 125 def implicit_condition_block @implicit_condition_block end |
Instance Method Details
#next=(state) ⇒ Object
132 133 134 |
# File 'lib/simplerubysteps.rb', line 132 def next=(state) @dict[:Next] = (state.is_a? Symbol) ? state : state.name end |
#perform_action(choice_name, output) ⇒ Object
140 141 142 143 144 |
# File 'lib/simplerubysteps.rb', line 140 def perform_action(choice_name, output) if @implicit_condition_block output["#{choice_name}_#{@dict[:Next]}"] = @implicit_condition_block.call(output) ? "yes" : "no" end end |
#render ⇒ Object
136 137 138 |
# File 'lib/simplerubysteps.rb', line 136 def render @dict end |