Class: SoberSwag::Reporting::Output::Number

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

Overview

Output numbers of some variety.

Instance Method Summary collapse

Methods inherited from Base

#view, #views

Methods included from Interface

#call!, #described, #enum, #in_range, #list, #nilable, #partitioned, #referenced, #reporting?, #serialize, #via_map

Instance Method Details

#call(input) ⇒ Object



7
8
9
# File 'lib/sober_swag/reporting/output/number.rb', line 7

def call(input)
  input
end

#serialize_report(input) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/sober_swag/reporting/output/number.rb', line 11

def serialize_report(input)
  result = call(input)

  return Report::Value.new(['was not a number']) unless result.is_a?(Numeric)

  result
end

#swagger_schemaObject



19
20
21
# File 'lib/sober_swag/reporting/output/number.rb', line 19

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