Sha256: c76f5fa2d0778e16c00296838986e7a8359b16a77c184338f805fe9e64080f1e
Contents?: true
Size: 516 Bytes
Versions: 2
Compression:
Stored size: 516 Bytes
Contents
module NxtSchema module Validators class GreaterThan < Validator def initialize(threshold) @threshold = threshold end register_as :greater_than attr_reader :threshold def build lambda do |application, value| if value > threshold true else message = translate_error(application.locale, value: value, threshold: threshold) application.add_error(message) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nxt_schema-1.0.1 | lib/nxt_schema/validators/greater_than.rb |
nxt_schema-1.0.0 | lib/nxt_schema/validators/greater_than.rb |