Sha256: cc78921ddf95179d7b13c10561ca3092b8c317761acb623dbd5d9a4ea71240dc

Contents?: true

Size: 613 Bytes

Versions: 2

Compression:

Stored size: 613 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
        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

2 entries across 2 versions & 1 rubygems

Version Path
braintree-1.0.1 lib/braintree/base_module.rb
braintree-1.0.0 lib/braintree/base_module.rb