Class: Roast::Workflow::InputStep
- Defined in:
- lib/roast/workflow/input_step.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#prompt_text ⇒ Object
readonly
Returns the value of attribute prompt_text.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#step_name ⇒ Object
readonly
Returns the value of attribute step_name.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from BaseStep
#available_tools, #coerce_to, #context_path, #json, #model, #name, #params, #print_response, #resource, #workflow
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(workflow, config:, **kwargs) ⇒ InputStep
constructor
A new instance of InputStep.
Constructor Details
#initialize(workflow, config:, **kwargs) ⇒ InputStep
Returns a new instance of InputStep.
10 11 12 13 |
# File 'lib/roast/workflow/input_step.rb', line 10 def initialize(workflow, config:, **kwargs) super(workflow, **kwargs) parse_config(config) end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
8 9 10 |
# File 'lib/roast/workflow/input_step.rb', line 8 def default @default end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/roast/workflow/input_step.rb', line 8 def end |
#prompt_text ⇒ Object (readonly)
Returns the value of attribute prompt_text.
8 9 10 |
# File 'lib/roast/workflow/input_step.rb', line 8 def prompt_text @prompt_text end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
8 9 10 |
# File 'lib/roast/workflow/input_step.rb', line 8 def required @required end |
#step_name ⇒ Object (readonly)
Returns the value of attribute step_name.
8 9 10 |
# File 'lib/roast/workflow/input_step.rb', line 8 def step_name @step_name end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
8 9 10 |
# File 'lib/roast/workflow/input_step.rb', line 8 def timeout @timeout end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/roast/workflow/input_step.rb', line 8 def type @type end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/roast/workflow/input_step.rb', line 15 def call # Get user input based on the configured type result = case type when "boolean" prompt_boolean when "choice" prompt_choice when "password" prompt_password else prompt_text_input end # Store the result in workflow state if a name was provided store_in_state(result) if step_name result rescue Interrupt raise Roast::Errors::ExitEarly rescue Timeout::Error handle_timeout end |