Class: Braintree::Errors
- Inherits:
-
Object
- Object
- Braintree::Errors
- Includes:
- Enumerable
- Defined in:
- lib/braintree/errors.rb
Instance Method Summary collapse
- #_inner_inspect ⇒ Object
- #each(&block) ⇒ Object
- #for(scope) ⇒ Object
-
#initialize(data = {}) ⇒ Errors
constructor
A new instance of Errors.
- #inspect ⇒ Object
-
#size ⇒ Object
Returns the total number of validation errors at all levels of nesting.
Constructor Details
#initialize(data = {}) ⇒ Errors
Returns a new instance of Errors.
5 6 7 8 |
# File 'lib/braintree/errors.rb', line 5 def initialize(data = {}) data = data.merge(:errors => []) unless data @errors = ValidationErrorCollection.new(data) end |
Instance Method Details
#_inner_inspect ⇒ Object
29 30 31 |
# File 'lib/braintree/errors.rb', line 29 def _inner_inspect @errors._inner_inspect end |
#each(&block) ⇒ Object
10 11 12 |
# File 'lib/braintree/errors.rb', line 10 def each(&block) @errors.deep_errors.each(&block) end |
#for(scope) ⇒ Object
14 15 16 |
# File 'lib/braintree/errors.rb', line 14 def for(scope) @errors.for(scope) end |
#inspect ⇒ Object
18 19 20 |
# File 'lib/braintree/errors.rb', line 18 def inspect "#<#{self.class} #{_inner_inspect}>" end |
#size ⇒ Object
Returns the total number of validation errors at all levels of nesting. For example, if creating a customer with a credit card and a billing address, and each of the customer, credit card, and billing address has 1 error, this method will return 3.
25 26 27 |
# File 'lib/braintree/errors.rb', line 25 def size @errors.deep_size end |