lib/command-builder.rb
##
# Adds an item to command. If option is Symbol or value isn't +nil+,
# it will apply the item as an argument, in otherwise, it will treat
# as an symbol.
#
# @overload add(option)
#   Adds parameter.
#   @param [Object] option parameter value
#   @see #parameter
# @overload add(options)
#   Adds parameters
#   @param [Array] options parameters values
#   @see #parameters
# @overload add(option, value = nil)
#   Adds argument.
#   @param [Symbol] option argument name
#   @param [Object] value argument value
#   @see #argument
#
# @example
#   cmd = Command::new(:jpegoptim)
#   cmd << :preserve    # will be rendered as 'jpegoptim --preserve'
#   cmd << "file.jpg"   # will be rendered as 'jpegoptiom --preserve file.jpg'
#

Adds an item to command. If option is Symbol or value isn't +nil+,
it will apply the item as an argument, in otherwise, it will treat
as an symbol.
Adds an item to command . If option is Symbol or value isn ' t + nil + it will apply the item as an argument in otherwise it will treat as an symbol .
def add(option, value = nil)
        if option.kind_of? Symbol or not value.nil?
            self.argument(option, value)
        elsif option.kind_of? Array
            self.parameters(option)
        else
            self.parameter(option)
        end
    end
def add ( option , value = nil ) if option . kind_of? Symbol or not value . nil? self . argument ( option , value ) elsif option . kind_of? Array self . parameters ( option ) else self . parameter ( option ) end end
Adds an item to command.
Adds an item to command .
option
<not_specific>
value
<not_specific>
overload
add(option) Adds parameter. @param [Object] option parameter value @see #parameter
add ( option ) Adds parameter . @param [ Object ] option parameter value @see #parameter
overload
add(options) Adds parameters @param [Array] options parameters values @see #parameters
add ( options ) Adds parameters @param [ Array ] options parameters values @see #parameters
overload
add(option, value = nil) Adds argument. @param [Symbol] option argument name @param [Object] value argument value @see #argument
add ( option value = nil ) Adds argument . @param [ Symbol ] option argument name @param [ Object ] value argument value @see #argument
example
cmd = Command::new(:jpegoptim) cmd << :preserve # will be rendered as 'jpegoptim --preserve' cmd << "file.jpg" # will be rendered as 'jpegoptiom --preserve file.jpg'
cmd = Command :: new ( : jpegoptim ) cmd << : preserve # will be rendered as ' jpegoptim -- preserve ' cmd << " file . jpg " # will be rendered as ' jpegoptiom -- preserve file . jpg '