Class: String

Inherits:
Object show all
Defined in:
lib/objective_command/helpers.rb

Instance Method Summary collapse

Instance Method Details

#to_io_for_ocmdObject



36
37
38
39
40
# File 'lib/objective_command/helpers.rb', line 36

def to_io_for_ocmd
  tmp = TempPath.new
  tmp.open('w') { |f| f.write self }
  tmp.to_io_for_ocmd
end

#to_ocmdObject

Make a command from a String.

Split your command using the Shellwords module.



32
33
34
# File 'lib/objective_command/helpers.rb', line 32

def to_ocmd
  Shellwords.shellwords(self).to_ocmd
end

#to_ocmd_argsObject



42
43
44
# File 'lib/objective_command/helpers.rb', line 42

def to_ocmd_args
  Shellwords.shellwords(self)
end

#to_shObject



46
47
48
# File 'lib/objective_command/helpers.rb', line 46

def to_sh
  (self =~ /[^-\w:_\/\.@]/)? dump : self
end