Class: WIP::Runner::Shell::Handlers::Script

Inherits:
Base
  • Object
show all
Defined in:
lib/wip/runner/shell/handlers/script.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#content, #output, #type

Constructor Details

#initializeScript

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

#promptsObject (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, options = {})
  @prompts << [term, options] # Prompt.new(...)
end