Class: WIP::Runner::Shell::Handlers::Script
- Defined in:
- lib/wip/runner/shell/handlers/script.rb
Instance Attribute Summary collapse
-
#prompts ⇒ Object
readonly
Returns the value of attribute prompts.
Instance Method Summary collapse
- #args(array) ⇒ Object
- #execute(ui, env, &block) ⇒ Object
-
#initialize ⇒ Script
constructor
A new instance of Script.
- #name(value) ⇒ Object
- #prompt(term, options = {}) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ Script
Returns a new instance of Script.
11 12 13 14 15 16 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 11 def initialize(*) @name = 'script' @args = [] @prompts = [] super end |
Instance Attribute Details
#prompts ⇒ Object (readonly)
Returns the value of attribute prompts.
9 10 11 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 9 def prompts @prompts end |
Instance Method Details
#args(array) ⇒ Object
26 27 28 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 26 def args(array) @args = array end |
#execute(ui, env, &block) ⇒ Object
18 19 20 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 18 def execute(ui, env, &block) prompts.empty? ? simplex!(ui, env, &block) : complex!(ui, env, &block) end |
#name(value) ⇒ Object
22 23 24 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 22 def name(value) @name = value end |
#prompt(term, options = {}) ⇒ Object
30 31 32 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 30 def prompt(term, = {}) @prompts << [term, ] # Prompt.new(...) end |