class Apipie::Validator::BooleanValidator

Public Class Methods

build(param_description, argument, options, block) click to toggle source
# File lib/apipie/validator.rb, line 404
def self.build(param_description, argument, options, block)
  if argument == :bool || argument == :boolean
    self.new(param_description)
  end
end

Public Instance Methods

description() click to toggle source
# File lib/apipie/validator.rb, line 414
def description
  string = %w(true false 1 0).map { |value| "<code>#{value}</code>" }.join(', ')
  "Must be one of: #{string}"
end
expected_type() click to toggle source
# File lib/apipie/validator.rb, line 410
def expected_type
  'boolean'
end
validate(value) click to toggle source
# File lib/apipie/validator.rb, line 400
def validate(value)
  %w[true false 1 0].include?(value.to_s)
end