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
- #description(format = :text) ⇒ Object
- #execute(io, 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
35 36 37 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 35 def args(array) @args = array end |
#description(format = :text) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 18 def description(format = :text) case format when :markdown "```\n#{@content}\n```" else @content end end |
#execute(io, env, &block) ⇒ Object
27 28 29 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 27 def execute(io, env, &block) prompts.empty? ? simplex!(io, env, &block) : complex!(io, env, &block) end |
#name(value) ⇒ Object
31 32 33 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 31 def name(value) @name = value end |
#prompt(term, options = {}) ⇒ Object
39 40 41 |
# File 'lib/wip/runner/shell/handlers/script.rb', line 39 def prompt(term, = {}) @prompts << [term, ] # Prompt.new(...) end |