class NxtSchema::Validator::ValidateWithProxy
Attributes
aggregated_errors[R]
node[R]
Public Class Methods
new(node)
click to toggle source
# File lib/nxt_schema/validators/validate_with_proxy.rb, line 4 def initialize(node) @node = node @aggregated_errors = [] end
Public Instance Methods
add_error(error)
click to toggle source
# File lib/nxt_schema/validators/validate_with_proxy.rb, line 20 def add_error(error) aggregated_errors << error false end
copy_aggregated_errors_to_node()
click to toggle source
# File lib/nxt_schema/validators/validate_with_proxy.rb, line 25 def copy_aggregated_errors_to_node aggregated_errors.each do |error| node.add_error(error) end end
validate(&block)
click to toggle source
# File lib/nxt_schema/validators/validate_with_proxy.rb, line 13 def validate(&block) result = instance_exec(&block) return if result copy_aggregated_errors_to_node end
Private Instance Methods
validator(key, *args)
click to toggle source
# File lib/nxt_schema/validators/validate_with_proxy.rb, line 35 def validator(key, *args) validator = node.node.send(:validator, key, *args) validator.call(self, node.input) end