module Braintree::BaseModule::Methods
Public Instance Methods
copy_instance_variables_from_object(object)
click to toggle source
# File lib/braintree/base_module.rb, line 13 def copy_instance_variables_from_object(object) object.instance_variables.each do |ivar| instance_variable_set ivar, object.instance_variable_get(ivar) end end
return_object_or_raise(object_to_return) { || ... }
click to toggle source
# File lib/braintree/base_module.rb, line 4 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
set_instance_variables_from_hash(hash)
click to toggle source
# File lib/braintree/base_module.rb, line 19 def set_instance_variables_from_hash(hash) hash.each do |key, value| if key == :global_id instance_variable_set "@graphql_id", value elsif key == :android_pay_cards instance_variable_set "@google_pay_cards", value elsif key == :android_pay_card instance_variable_set "@google_pay_card", value elsif key == :android_pay_details instance_variable_set "@google_pay_details", value end instance_variable_set "@#{key}", value end end
singleton_class()
click to toggle source
# File lib/braintree/base_module.rb, line 35 def singleton_class class << self; self; end end