class OptParseValidator::OptInteger

Implementation of the Integer Option

Public Instance Methods

validate(value) click to toggle source

@param [ String ] value

@return [ Integer ]

# File lib/opt_parse_validator/opts/integer.rb, line 9
def validate(value)
  raise Error, "#{value} is not an integer" if value.to_i.to_s != value

  value.to_i
end