lib/nxt_schema/validators/attribute.rb in nxt_schema-0.1.2 vs lib/nxt_schema/validators/attribute.rb in nxt_schema-1.0.0
- old
+ new
@@ -10,18 +10,18 @@
attr_reader :method, :expectation
# Query any attribute on a value with validator(:attribute, :size, ->(s) { s < 7 })
def build
- lambda do |node, value|
+ lambda do |application, value|
raise ArgumentError, "#{value} does not respond to query: #{method}" unless value.respond_to?(method)
if expectation.call(value.send(method))
true
else
- node.add_error(
+ application.add_error(
translate_error(
- node.locale,
+ application.locale,
attribute: value,
attribute_name: method,
value: value.send(method)
)
)