Class: SoberSwag::Reporting::Input::Number

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

Overview

Parse some kind of number.

Instance Method Summary collapse

Methods included from Interface

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

Instance Method Details

#call(input) ⇒ Object



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

def call(input)
  return Report::Value.new(['is not a number']) unless input.is_a?(Numeric)

  input
end

#multiple_of(other) ⇒ SoberSwag::Reporting::Input::MultipleOf

Parameters:

  • other (Integer)

    number to specify this is a multiple of

Returns:



16
17
18
# File 'lib/sober_swag/reporting/input/number.rb', line 16

def multiple_of(other)
  MultipleOf.new(self, other)
end

#swagger_schemaObject



20
21
22
# File 'lib/sober_swag/reporting/input/number.rb', line 20

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