class Apipie::Validator::BooleanValidator
Public Class Methods
build(param_description, argument, options, block)
click to toggle source
# File lib/apipie/validator.rb, line 465 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 475 def description string = %w(true false 1 0).map { |value| format_description_value(value) }.join(', ') "Must be one of: #{string}." end
expected_type()
click to toggle source
# File lib/apipie/validator.rb, line 471 def expected_type 'boolean' end
validate(value)
click to toggle source
# File lib/apipie/validator.rb, line 461 def validate(value) %w[true false 1 0].include?(value.to_s) end