Class: Mattock::ShellEscaped

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

Instance Attribute Summary

Attributes inherited from CommandLine

#env, #executable, #options, #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, #run, #set_env, #spawn_process, #spin_off, #string_format, #succeeds?, #verbose

Constructor Details

#initialize(cmd) ⇒ ShellEscaped

Returns a new instance of ShellEscaped.



177
178
179
# File 'lib/mattock/command-line.rb', line 177

def initialize(cmd)
  @escaped = cmd
end

Instance Method Details

#commandObject



181
182
183
# File 'lib/mattock/command-line.rb', line 181

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

#command_environmentObject



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

def command_environment
  {}
end

#nameObject



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

def name
  @name || @escaped.name
end

#to_sObject



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

def to_s
  command
end