Sha256: d3e096fec053566097e07725e3827afc8b6b7f2cf56381856cd1f47fb1881fbd

Contents?: true

Size: 772 Bytes

Versions: 89

Compression:

Stored size: 772 Bytes

Contents

module Braintree
  class Errors
    include Enumerable

    def initialize(data = {}) # :nodoc:
      @errors = ValidationErrorCollection.new(data.merge(:errors => []))
    end

    def each(&block)
      @errors.deep_errors.each(&block)
    end

    def for(scope)
      @errors.for(scope)
    end

    def inspect # :nodoc:
      "#<#{self.class} #{_inner_inspect}>"
    end

    # 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.
    def size
      @errors.deep_size
    end

    def _inner_inspect # :nodoc:
      @errors._inner_inspect
    end
  end
end

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
braintree-2.48.1 lib/braintree/errors.rb
braintree-2.48.0 lib/braintree/errors.rb
braintree-2.47.0 lib/braintree/errors.rb
braintree-2.46.0 lib/braintree/errors.rb
braintree-2.45.0 lib/braintree/errors.rb
braintree-2.44.0 lib/braintree/errors.rb
braintree-2.43.0 lib/braintree/errors.rb
braintree-2.42.0 lib/braintree/errors.rb
braintree-2.41.0 lib/braintree/errors.rb