Class: Mattock::CommandChain

Inherits:
CommandLine show all
Defined in:
lib/mattock/command-line.rb

Direct Known Subclasses

PipelineChain, PrereqChain, WrappingChain

Instance Attribute Summary (collapse)

Attributes inherited from CommandLine

#executable, #options

Instance Method Summary (collapse)

Methods inherited from CommandLine

#command, #copy_stream_to, emit_recording, execute, #must_succeed!, original_execute, #redirect_from, #redirect_stderr, #redirect_stdin, #redirect_stdout, #redirect_to, #run, #succeeds?, #verbose

Constructor Details

- (CommandChain) initialize {|_self| ... }

A new instance of CommandChain

Yields:

  • (_self)

Yield Parameters:



128
129
130
131
# File 'lib/mattock/command-line.rb', line 128

def initialize
  @commands = []
  yield self if block_given?
end

Instance Attribute Details

- (Object) commands (readonly)

Returns the value of attribute commands



133
134
135
# File 'lib/mattock/command-line.rb', line 133

def commands
  @commands
end

Instance Method Details

- (Object) add(cmd) {|cmd| ... }

Yields:

  • (cmd)


135
136
137
138
# File 'lib/mattock/command-line.rb', line 135

def add(cmd)
  yield cmd if block_given?
  @commands << cmd
end

- (Object) name



140
141
142
# File 'lib/mattock/command-line.rb', line 140

def name
  @name || @commands.last.name
end