master
1class Money
2 attr_reader :amount
3
4 def initialize(amount)
5 @amount = amount
6 end
7
8 def +(other)
9 Money.new(@amount + other.amount)
10 end
11
12 def -(other)
13 Money.new(@amount - other.amount)
14 end
15
16 def ==(other)
17 @amount == other.amount
18 end
19end