class OptParseValidator::OptArray

Implementation of the Array Option

Public Instance Methods

append_help_messages() click to toggle source

@return [ Void ]

Calls superclass method
# File lib/opt_parse_validator/opts/array.rb, line 7
def append_help_messages
  option << "Separator to use between the values: '#{separator}'"

  super
end
normalize(values) click to toggle source

See OptBase#normalize @param [ Array ] values

Calls superclass method
# File lib/opt_parse_validator/opts/array.rb, line 27
def normalize(values)
  values.each_with_index do |value, index|
    values[index] = super(value)
  end
  values
end
separator() click to toggle source

@return [ String ] The separator used to split the string into an array

# File lib/opt_parse_validator/opts/array.rb, line 21
def separator
  attrs[:separator] || ','
end
validate(value) click to toggle source

@param [ String ] value

@return [ Array ]

Calls superclass method
# File lib/opt_parse_validator/opts/array.rb, line 16
def validate(value)
  super(value).split(separator)
end