Class: CommandBuilder::StringArgumentFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/command_builder_generator/lib/argument_formatters/string_argument_formatter.rb

Instance Method Summary collapse

Instance Method Details

#format(argument) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/command_builder_generator/lib/argument_formatters/string_argument_formatter.rb', line 4

def format(argument)
  s = argument
  case
    when s =~ /$".*"^/
      s
    when s.include?(' ')
      %Q["#{s}"]
    else
      s
  end
end