class NxtSchema::Validators::Included
Attributes
target[R]
Public Class Methods
new(target)
click to toggle source
# File lib/nxt_schema/validators/included_in.rb, line 4 def initialize(target) @target = target end
Public Instance Methods
build()
click to toggle source
# File lib/nxt_schema/validators/included_in.rb, line 11 def build lambda do |node, value| if target.include?(value) true else message = translate_error(node.locale, value: value, target: target) node.add_error(message) end end end