lib/nxt_schema/validators/attribute.rb in nxt_schema-1.0.1 vs lib/nxt_schema/validators/attribute.rb in nxt_schema-1.0.2
- 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 |application, value|
+ lambda do |node, value|
raise ArgumentError, "#{value} does not respond to query: #{method}" unless value.respond_to?(method)
if expectation.call(value.send(method))
true
else
- application.add_error(
+ node.add_error(
translate_error(
- application.locale,
+ node.locale,
attribute: value,
attribute_name: method,
value: value.send(method)
)
)