Sha256: 3a74960d6eb998de1241eb273b82be4048475ce8984126780dd5c1d7304100ed

Contents?: true

Size: 644 Bytes

Versions: 7

Compression:

Stored size: 644 Bytes

Contents

module SoberSwag
  module Reporting
    module Input
      module Converting
        Integer =
          (SoberSwag::Reporting::Input.number.format('integer').mapped(&:to_i)) |
          (SoberSwag::Reporting::Input.text.format('integer').mapped do |v|
            Integer(v)
          rescue ArgumentError
            Report::Value.new(['was not an integer string'])
          end).described(<<~MARKDOWN).referenced('SoberSwag.Converting.Integer')
            Integer formatted input.

            With either convert a JSON number to an integer, or accept a string representation of an integer.
          MARKDOWN
      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/converting/integer.rb
sober_swag-0.25.1 lib/sober_swag/reporting/input/converting/integer.rb
sober_swag-0.25.0 lib/sober_swag/reporting/input/converting/integer.rb
sober_swag-0.24.1 lib/sober_swag/reporting/input/converting/integer.rb
sober_swag-0.24.0 lib/sober_swag/reporting/input/converting/integer.rb
sober_swag-0.23.0 lib/sober_swag/reporting/input/converting/integer.rb
sober_swag-0.22.0 lib/sober_swag/reporting/input/converting/integer.rb