Object
Accesses the error at the given index.
# File lib/braintree/validation_error_collection.rb, line 16 def [](index) @errors[index] end
Returns an array of ValidationError objects at this level and all nested levels in the error hierarchy
# File lib/braintree/validation_error_collection.rb, line 22 def deep_errors ([@errors] + @nested.values.map { |error_collection| error_collection.deep_errors }).flatten end
# File lib/braintree/validation_error_collection.rb, line 26 def deep_size size + @nested.values.inject(0) { |count, error_collection| count + error_collection.deep_size } end
Iterates over errors at the current level. Nested errors will not be yielded.
# File lib/braintree/validation_error_collection.rb, line 31 def each(&block) @errors.each(&block) end
Returns a ValidationErrorCollection of errors nested under the given nested_key. Returns nil if there are not any errors nested under the given key.
# File lib/braintree/validation_error_collection.rb, line 37 def for(nested_key) @nested[nested_key] end
# File lib/braintree/validation_error_collection.rb, line 41 def for_index(index) self.for("index_#{index}".to_sym) end
Returns an array of ValidationError objects on the given attribute.
# File lib/braintree/validation_error_collection.rb, line 50 def on(attribute) @errors.select { |error| error.attribute == attribute.to_s } end
Returns an array of ValidationError objects at the given level in the error hierarchy
# File lib/braintree/validation_error_collection.rb, line 55 def shallow_errors @errors.dup end
Generated with the Darkfish Rdoc Generator 2.