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 |
# File 'lib/braintree/errors.rb', line 5 def initialize(data = {}) @errors = ValidationErrorCollection.new(data.merge(:errors => [])) end |
Instance Method Details
#_inner_inspect ⇒ Object
28 29 30 |
# File 'lib/braintree/errors.rb', line 28 def _inner_inspect @errors._inner_inspect end |
#each(&block) ⇒ Object
9 10 11 |
# File 'lib/braintree/errors.rb', line 9 def each(&block) @errors.deep_errors.each(&block) end |
#for(scope) ⇒ Object
13 14 15 |
# File 'lib/braintree/errors.rb', line 13 def for(scope) @errors.for(scope) end |
#inspect ⇒ Object
17 18 19 |
# File 'lib/braintree/errors.rb', line 17 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.
24 25 26 |
# File 'lib/braintree/errors.rb', line 24 def size @errors.deep_size end |