Sha256: f08abff6158e5bd55ce2d1705f857c41a738698ab4f09f9100a27635b4887e8e

Contents?: true

Size: 619 Bytes

Versions: 11

Compression:

Stored size: 619 Bytes

Contents

module Braintree
  module BaseModule # :nodoc: all
    module Methods
      def return_object_or_raise(object_to_return)
        result = yield
        if result.success?
          result.send object_to_return
        else
          raise ValidationsFailed.new(result)
        end
      end

      def set_instance_variables_from_hash(hash)
        hash.each do |key, value|
          instance_variable_set "@#{key}", value
        end
      end

      def singleton_class
        class << self; self; end
      end
    end

    def self.included(klass)
      klass.extend Methods
    end
    include Methods
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
braintree-2.4.0 lib/braintree/base_module.rb
braintree-2.3.1 lib/braintree/base_module.rb
braintree-2.2.0 lib/braintree/base_module.rb
braintree-2.1.0 lib/braintree/base_module.rb
braintree-2.0.0 lib/braintree/base_module.rb
braintree-1.2.1 lib/braintree/base_module.rb
braintree-1.2.0 lib/braintree/base_module.rb
braintree-1.1.3 lib/braintree/base_module.rb
braintree-1.1.2 lib/braintree/base_module.rb
braintree-1.1.1 lib/braintree/base_module.rb
braintree-1.1.0 lib/braintree/base_module.rb