Class: Caliph::ShellEscaped

Inherits:
CommandLine show all
Defined in:
lib/caliph/shell-escaped.rb

Instance Attribute Summary

Attributes inherited from CommandLine

#definition_watcher, #env, #executable, #options, #output_stream, #redirections, #verbose

Instance Method Summary collapse

Methods inherited from CommandLine

#copy_stream_to, emit_recording, #execute, #from, #must_succeed!, #options_composition, #original_execute, #redirect_both, #redirect_from, #redirect_stderr, #redirect_stdin, #redirect_stdout, #redirect_to, #run, #run_as_replacement, #run_detached, #run_in_background, #set_env, #string_format, #succeeds?

Methods included from DefineOp

included

Constructor Details

#initialize(cmd) ⇒ ShellEscaped

Returns a new instance of ShellEscaped.



5
6
7
# File 'lib/caliph/shell-escaped.rb', line 5

def initialize(cmd)
  @escaped = cmd
end

Instance Method Details

#commandObject



9
10
11
# File 'lib/caliph/shell-escaped.rb', line 9

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

#command_environmentObject



13
14
15
# File 'lib/caliph/shell-escaped.rb', line 13

def command_environment
  {}
end

#nameObject



17
18
19
# File 'lib/caliph/shell-escaped.rb', line 17

def name
  @name || @escaped.name
end

#to_sObject



21
22
23
# File 'lib/caliph/shell-escaped.rb', line 21

def to_s
  command
end

#valid?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/caliph/shell-escaped.rb', line 25

def valid?
  @escaped.valid?
end