diff options
Diffstat (limited to 'lib/money.rb')
| -rw-r--r-- | lib/money.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/money.rb b/lib/money.rb new file mode 100644 index 0000000..6be9ec9 --- /dev/null +++ b/lib/money.rb @@ -0,0 +1,19 @@ +class Money + attr_reader :amount + + def initialize(amount) + @amount = amount + end + + def +(other_money) + Money.new(amount + other_money.amount) + end + + def ==(other_money) + amount == other_money.amount + end + + def eql?(other_money) + self == other_money + end +end |
