Sha256: f1b4083cae8f2363852a3a17c1b865d679fb2d4659d71bc664e2d9fa27ada235

Contents?: true

Size: 524 Bytes

Versions: 4

Compression:

Stored size: 524 Bytes

Contents

module NxtSchema
  module Validators
    class GreaterThanOrEqual < Validator
      def initialize(threshold)
        @threshold = threshold
      end

      register_as :greater_than_or_equal, :gt_or_eql
      attr_reader :threshold

      def build
        lambda do |node, value|
          if value >= threshold
            true
          else
            message = translate_error(node.locale, value: value, threshold: threshold)
            node.add_error(message)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nxt_schema-1.0.2 lib/nxt_schema/validators/greater_than_or_equal.rb
nxt_schema-0.1.2 lib/nxt_schema/validators/greater_than_or_equal.rb
nxt_schema-0.1.1 lib/nxt_schema/validators/greater_than_or_equal.rb
nxt_schema-0.1.0 lib/nxt_schema/validators/greater_than_or_equal.rb