Class: Apipie::Params::Descriptor::Number

Inherits:
Regexp show all
Defined in:
lib/apipie/params/descriptor.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Regexp

#initialize, #json_schema

Methods inherited from JsonSchema

inherited, #json_schema, #validate!

Methods inherited from Base

find, inherited, #initialize, #invalid_param_error, #to_json

Constructor Details

This class inherits a constructor from Apipie::Params::Descriptor::Regexp

Class Method Details

.build(argument, options, block) ⇒ Object



307
308
309
310
311
# File 'lib/apipie/params/descriptor.rb', line 307

def self.build(argument, options, block)
  if argument == :number
    self.new(self.pattern, options)
  end
end

.patternObject



317
318
319
# File 'lib/apipie/params/descriptor.rb', line 317

def self.pattern
  /\A(0|[1-9]\d*)\Z$/
end

Instance Method Details

#descriptionObject



313
314
315
# File 'lib/apipie/params/descriptor.rb', line 313

def description
  "Must be a number."
end