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
Returns a new instance of ChoiceItem.
268 269 270 271 |
# File 'lib/simplerubysteps/model.rb', line 268 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.
266 267 268 |
# File 'lib/simplerubysteps/model.rb', line 266 def implicit_condition_block @implicit_condition_block end |
Instance Method Details
#next=(state) ⇒ Object
273 274 275 |
# File 'lib/simplerubysteps/model.rb', line 273 def next=(state) @dict[:Next] = (state.is_a? Symbol) ? state : state.name end |
#perform_action(choice_name, output) ⇒ Object
281 282 283 284 285 |
# File 'lib/simplerubysteps/model.rb', line 281 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
277 278 279 |
# File 'lib/simplerubysteps/model.rb', line 277 def render @dict end |