class Apipie::Validator::BooleanValidator

Public Class Methods

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

Public Instance Methods

description() click to toggle source
# File lib/apipie/validator.rb, line 284
def description
  "Has to be a boolean"
end
error() click to toggle source
# File lib/apipie/validator.rb, line 280
def error
  "Parameter #{param_name} expecting to be a boolean value, got: #{@error_value}"
end
validate(value) click to toggle source
# File lib/apipie/validator.rb, line 270
def validate(value)
  %w[true false].include?(value.to_s)
end