Sha256: 550d302a3848f5e14f083490dd3bc1ba804a9f552a8f4366810e346bed9b5491

Contents?: true

Size: 608 Bytes

Versions: 7

Compression:

Stored size: 608 Bytes

Contents

module SoberSwag
  module Reporting
    module Input
      ##
      # Null input values.
      # Validates that the input is null.
      class Null < Base
        def call(value)
          return nil if value.nil?

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

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

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

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

        include Comparable

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sober_swag-0.25.2 lib/sober_swag/reporting/input/null.rb
sober_swag-0.25.1 lib/sober_swag/reporting/input/null.rb
sober_swag-0.25.0 lib/sober_swag/reporting/input/null.rb
sober_swag-0.24.1 lib/sober_swag/reporting/input/null.rb
sober_swag-0.24.0 lib/sober_swag/reporting/input/null.rb
sober_swag-0.23.0 lib/sober_swag/reporting/input/null.rb
sober_swag-0.22.0 lib/sober_swag/reporting/input/null.rb