lib/zold/amount.rb in zold-0.0.8 vs lib/zold/amount.rb in zold-0.1

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2018 Zerocracy, Inc. +# Copyright (c) 2018 Yegor Bugayenko # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the 'Software'), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -20,11 +20,11 @@ require 'rainbow' # The amount. # Author:: Yegor Bugayenko (yegor256@gmail.com) -# Copyright:: Copyright (c) 2018 Zerocracy, Inc. +# Copyright:: Copyright (c) 2018 Yegor Bugayenko # License:: MIT module Zold # Amount class Amount def initialize(coins: nil, zld: nil) @@ -53,9 +53,17 @@ end end def ==(other) @coins == other.to_i + end + + def >(other) + @coins > other.to_i + end + + def <(other) + @coins < other.to_i end def +(other) Amount.new(coins: @coins + other.to_i) end