Class: Apipie::Validator::BooleanValidator
Instance Attribute Summary
#param_description
Class Method Summary
collapse
Instance Method Summary
collapse
#error, find, inherited, #initialize, #merge_with, #param_name, #params_ordered, #to_json, #to_s, #valid?
Class Method Details
.build(param_description, argument, options, block) ⇒ Object
404
405
406
407
408
|
# File 'lib/apipie/validator.rb', line 404
def self.build(param_description, argument, options, block)
if argument == :bool
self.new(param_description)
end
end
|
Instance Method Details
#description ⇒ Object
414
415
416
|
# File 'lib/apipie/validator.rb', line 414
def description
"Must be 'true' or 'false'"
end
|
#expected_type ⇒ Object
410
411
412
|
# File 'lib/apipie/validator.rb', line 410
def expected_type
'boolean'
end
|
#validate(value) ⇒ Object
400
401
402
|
# File 'lib/apipie/validator.rb', line 400
def validate(value)
%w[true false].include?(value.to_s)
end
|