Sha256: b601f33ae98594127dbcc0267e5c4108eba7926a9eb4e222493c02c2b94c928e

Contents?: true

Size: 513 Bytes

Versions: 20

Compression:

Stored size: 513 Bytes

Contents

module Shogun
  module Verifier
    class Range
      def initialize(name:, data:, range:)
        @data = data
        @name = name
        @range = range
      end

      def valid?
        if @data.is_a?(String)
          @range.cover?(@data.size)
        else
          @range.cover?(@data)
        end
      end

      def id
        "#{@name}_was_out_of_range"
      end

      def context
        {
          "maximum" => @range.max,
          "minimum" => @range.min
        }
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
shogun-6.4.2 lib/shogun/verifier/range.rb
shogun-6.4.1 lib/shogun/verifier/range.rb
shogun-6.4.0 lib/shogun/verifier/range.rb
shogun-6.3.0 lib/shogun/verifier/range.rb
shogun-6.2.3 lib/shogun/verifier/range.rb
shogun-6.2.2 lib/shogun/verifier/range.rb
shogun-6.2.1 lib/shogun/verifier/range.rb
shogun-6.2.0 lib/shogun/verifier/range.rb
shogun-6.1.0 lib/shogun/verifier/range.rb
shogun-6.0.0 lib/shogun/verifier/range.rb
shogun-4.0.1 lib/shogun/verifier/range.rb
shogun-4.0.0 lib/shogun/verifier/range.rb
shogun-3.4.0 lib/shogun/verifier/range.rb
shogun-3.2.0 lib/shogun/verifier/range.rb
shogun-3.1.0 lib/shogun/verifier/range.rb
shogun-3.0.0 lib/shogun/verifier/range.rb
shogun-2.1.1 lib/shogun/verifier/range.rb
shogun-2.1.0 lib/shogun/verifier/range.rb
shogun-2.0.0 lib/shogun/verifier/range.rb
shogun-1.0.0 lib/shogun/verifier/range.rb