Class: NxtSchema::Validators::Excludes
- Defined in:
- lib/nxt_schema/validators/excludes.rb
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(target) ⇒ Excludes
constructor
A new instance of Excludes.
Methods inherited from Validator
Constructor Details
#initialize(target) ⇒ Excludes
Returns a new instance of Excludes.
4 5 6 |
# File 'lib/nxt_schema/validators/excludes.rb', line 4 def initialize(target) @target = target end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
9 10 11 |
# File 'lib/nxt_schema/validators/excludes.rb', line 9 def target @target end |
Instance Method Details
#build ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/nxt_schema/validators/excludes.rb', line 11 def build lambda do |node, value| if value.exclude?(target) true else = translate_error(node.locale, target: target, value: value) node.add_error() end end end |