Class: Simplerubysteps::ChoiceItem
- Inherits:
-
Object
- Object
- Simplerubysteps::ChoiceItem
- Defined in:
- lib/simplerubysteps/model.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
144 145 146 147 |
# File 'lib/simplerubysteps/model.rb', line 144 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.
142 143 144 |
# File 'lib/simplerubysteps/model.rb', line 142 def implicit_condition_block @implicit_condition_block end |
Instance Method Details
#next=(state) ⇒ Object
149 150 151 |
# File 'lib/simplerubysteps/model.rb', line 149 def next=(state) @dict[:Next] = (state.is_a? Symbol) ? state : state.name end |
#perform_action(choice_name, output) ⇒ Object
157 158 159 160 161 |
# File 'lib/simplerubysteps/model.rb', line 157 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
153 154 155 |
# File 'lib/simplerubysteps/model.rb', line 153 def render @dict end |