lib/braintree/successful_result.rb in braintree-1.0.1 vs lib/braintree/successful_result.rb in braintree-1.1.0
- old
+ new
@@ -1,6 +1,6 @@
-module Braintree
+module Braintree
# A SuccessfulResult will be returned from non-bang methods when
# validations pass. It will provide access to the created resource.
# For example, when creating a customer, SuccessfulResult will
# respond to +customer+ like so:
#
@@ -11,19 +11,19 @@
# else
# # have an ErrorResult
# end
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
end
def inspect # :nodoc:
inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
"#<#{self.class} #{inspected_attributes}>"