Class: Script::Prog

Inherits:
Object
  • Object
show all
Defined in:
lib/script.rb,
lib/plugins/bash.rb

Overview

where procedure required

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(toplevel, injection = nil, &block) ⇒ Prog

Returns a new instance of Prog.



82
83
84
85
86
87
# File 'lib/script.rb', line 82

def initialize(toplevel, injection = nil, &block)
  @toplevel = toplevel
  @injection = injection
  @prog = []
  instance_eval(&block)
end

Instance Attribute Details

#injectionObject (readonly)

Returns the value of attribute injection.



89
90
91
# File 'lib/script.rb', line 89

def injection
  @injection
end

Instance Method Details

#bash(injection = nil, &block) ⇒ Object



3
4
5
# File 'lib/plugins/bash.rb', line 3

def bash(injection = nil, &block)
  @prog.push Bash.new(@toplevel, injection, &block)
end

#doitObject



91
92
93
94
95
# File 'lib/script.rb', line 91

def doit
  @prog.each do |p|
    p.doit
  end
end

#echo(s) ⇒ Object


DSL



99
100
101
# File 'lib/script.rb', line 99

def echo(s)
  @prog.push Echo.new(@toplevel, s)
end

#run(tag) ⇒ Object



103
104
105
# File 'lib/script.rb', line 103

def run(tag)
  @prog.push Run.new(@toplevel, tag)
end