Class: SoberSwag::Reporting::Input::Bool

Inherits:
Base
  • Object
show all
Defined in:
lib/sober_swag/reporting/input/bool.rb

Overview

Convert booleans.

Instance Method Summary collapse

Methods included from Interface

#add_schema_key, #call!, #described, #enum, #format, #in_range, #list, #mapped, #modify_schema, #multiple_of, #optional, #or, #referenced, #swagger_path_schema, #swagger_query_schema, #|

Instance Method Details

#call(val) ⇒ Object



7
8
9
10
11
# File 'lib/sober_swag/reporting/input/bool.rb', line 7

def call(val)
  return Report::Value.new(['was not a bool']) unless [true, false].include?(val)

  val
end

#swagger_schemaObject



13
14
15
# File 'lib/sober_swag/reporting/input/bool.rb', line 13

def swagger_schema
  [{ type: 'boolean' }, {}]
end