Sha256: 45804961d7c1a864b3fc7a61ce9d3ceeff77db0276bb8bb3936446b24b770d76

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

module Braintree
  # See http://www.braintreepayments.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

1 entries across 1 versions & 1 rubygems

Version Path
braintree-2.10.1 lib/braintree/successful_result.rb