Sha256: 411cbb30542408f90a9f9ab740e1b33420e4e03ca351deace3ffc7c1aff314e9

Contents?: true

Size: 645 Bytes

Versions: 10

Compression:

Stored size: 645 Bytes

Contents

module Braintree
  # See http://www.braintreepaymentsolutions.com/docs/ruby/general/result_objects
  class SuccessfulResult
    include BaseModule

    def initialize(attributes = {}) # :nodoc:
      @attrs = attributes.keys
      singleton_class.class_eval do
        attributes.each do |key, value|
          define_method key do
            value
          end
        end
      end
    end

    def inspect # :nodoc:
      inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
      "#<#{self.class} #{inspected_attributes.join(" ")}>"
    end

    # Always returns true.
    def success?
      true
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
braintree-2.10.0 lib/braintree/successful_result.rb
braintree-2.9.1 lib/braintree/successful_result.rb
braintree-2.8.0 lib/braintree/successful_result.rb
braintree-2.7.0 lib/braintree/successful_result.rb
braintree-2.6.3 lib/braintree/successful_result.rb
braintree-2.6.2 lib/braintree/successful_result.rb
braintree-2.6.1 lib/braintree/successful_result.rb
braintree-2.6.0 lib/braintree/successful_result.rb
braintree-2.5.2 lib/braintree/successful_result.rb
braintree-2.5.1 lib/braintree/successful_result.rb