class Apipie::Validator::NumberValidator

Public Class Methods

build(param_description, argument, options, block) click to toggle source
# File lib/apipie/validator.rb, line 383
def self.build(param_description, argument, options, block)
  if argument == :number
    self.new(param_description)
  end
end
validate(value) click to toggle source
# File lib/apipie/validator.rb, line 393
def self.validate(value)
  value.to_s =~ /\A(0|[1-9]\d*)\Z$/
end

Public Instance Methods

description() click to toggle source
# File lib/apipie/validator.rb, line 389
def description
  "Must be a number."
end
validate(value) click to toggle source
# File lib/apipie/validator.rb, line 379
def validate(value)
  self.class.validate(value)
end