Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class Transaction
attr_accessor :amount, :success
def initialize(amount, success)
@amount = amount
@success = success
end
def success?
@success
end
def to_money
if success?
a = amount
a.to_f / 100
else
0
end
end
def self.credit(amount, success)
new(-amount, success)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.