Sha256: b0d83f14f15d86caa5a622cb469e1994999af9702352220ecdaed25de50e5fab
Contents?: true
Size: 596 Bytes
Versions: 1
Compression:
Stored size: 596 Bytes
Contents
module Apipie module Validator class IntegerValidator < Apipie::Validator::BaseValidator def initialize(param_description, argument) super(param_description) @type = argument end def validate(value) return false if value.nil? !!(value.to_s =~ /^[-+]?[0-9]+$/) end def self.build(param_description, argument, options, block) if argument == Integer || argument == Fixnum self.new(param_description, argument) end end def description "Must be #{@type}." end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aepic-0.0.4 | lib/apipie/validator/integer_validator.rb |