Sha256: bdf42acaf7d59cba417d7ce25b5316d5f0aa632fadabad85a12a5744882b15e5

Contents?: true

Size: 589 Bytes

Versions: 3

Compression:

Stored size: 589 Bytes

Contents

module SoberSwag
  module Reporting
    module Input
      ##
      # Parse some kind of number.
      class Number < Base
        def call(input)
          return Report::Value.new(['is not a number']) unless input.is_a?(Numeric)

          input
        end

        ##
        # @param other [Integer] number to specify this is a multiple of
        # @return [SoberSwag::Reporting::Input::MultipleOf]
        def multiple_of(other)
          MultipleOf.new(self, other)
        end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sober_swag-0.25.2 lib/sober_swag/reporting/input/number.rb
sober_swag-0.25.1 lib/sober_swag/reporting/input/number.rb
sober_swag-0.25.0 lib/sober_swag/reporting/input/number.rb