Class: SoberSwag::Reporting::Input::Null

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

Overview

Null input values. Validates that the input is null.

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

#<=>(other) ⇒ Object



22
23
24
# File 'lib/sober_swag/reporting/input/null.rb', line 22

def <=>(other)
  eql?(other) ? 0 : nil
end

#call(value) ⇒ Object



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

def call(value)
  return nil if value.nil?

  Report::Value.new(['was not nil'])
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/sober_swag/reporting/input/null.rb', line 18

def eql?(other)
  other.class == self.class
end

#hashObject



14
15
16
# File 'lib/sober_swag/reporting/input/null.rb', line 14

def hash
  [self.class.hash, 1].hash
end

#swagger_schemaObject



28
29
30
# File 'lib/sober_swag/reporting/input/null.rb', line 28

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