wpscanteam/OptParseValidator

View on GitHub
lib/opt_parse_validator/opts/positive_integer.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module OptParseValidator
  # Implementation of the Positive Integer Option
  class OptPositiveInteger < OptInteger
    # @param [ String ] value
    #
    # @return [ Integer ]
    def validate(value)
      i = super(value)
      raise Error, "#{i} is not > 0" unless i.positive?

      i
    end
  end
end