Class: Mattock::ShellEscaped

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

Instance Attribute Summary

Attributes inherited from CommandLine

#env, #executable, #options, #output_stream, #redirections

Instance Method Summary collapse

Methods inherited from CommandLine

#background, #collect_result, #complete, #copy_stream_to, define_chain_op, define_op, emit_recording, #execute, execute, #kill_process, #must_succeed!, #options_composition, #original_execute, #redirect_from, #redirect_stderr, #redirect_stdin, #redirect_stdout, #redirect_to, #replace_us, #report, #run, #set_env, #spawn_process, #spin_off, #string_format, #succeeds?, #verbose

Constructor Details

#initialize(cmd) ⇒ ShellEscaped

Returns a new instance of ShellEscaped.



186
187
188
# File 'lib/mattock/command-line.rb', line 186

def initialize(cmd)
  @escaped = cmd
end

Instance Method Details

#commandObject



190
191
192
# File 'lib/mattock/command-line.rb', line 190

def command
  "'" + @escaped.string_format.gsub(/'/,"\'") + "'"
end

#command_environmentObject



194
195
196
# File 'lib/mattock/command-line.rb', line 194

def command_environment
  {}
end

#nameObject



198
199
200
# File 'lib/mattock/command-line.rb', line 198

def name
  @name || @escaped.name
end

#to_sObject



202
203
204
# File 'lib/mattock/command-line.rb', line 202

def to_s
  command
end