class Apipie::Validator::BooleanValidator
Public Class Methods
build(param_description, argument, options, block)
click to toggle source
# File lib/apipie/validator.rb, line 470 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 480 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 476 def expected_type 'boolean' end
ignore_allow_blank?()
click to toggle source
# File lib/apipie/validator.rb, line 485 def ignore_allow_blank? true end
validate(value)
click to toggle source
# File lib/apipie/validator.rb, line 466 def validate(value) %w[true false 1 0].include?(value.to_s) end