Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/rexec/to_cmd.rb

Instance Method Summary collapse

Instance Method Details

#to_cmdObject

Conditionally quote a string if it contains whitespace or quotes.



23
24
25
26
27
28
29
# File 'lib/rexec/to_cmd.rb', line 23

def to_cmd
  if match(/\s|"|'/)
    self.dump
  else
    self
  end
end