module Monefy::Matchers

Encapsulate all the logic to compare differente Monefy instances

Public Instance Methods

!=(monefy) click to toggle source

Check if two distinct Monefy instances are different.

@param monefy [Monefy] another Monefy instance.

@return [Boolean] true if both instances are different and false if they are equal.

@example

Monefy.new(50, 'EUR') != Monefy.new(40, 'EUR') # => true
Monefy.new(50, 'EUR') != Monefy.new(55.5, 'USD') # => false
# File lib/monefy/matchers.rb, line 31
def != monefy
  validate_monefy_instance(monefy)

  amount != converted_money_currency(monefy)
end
<(monefy) click to toggle source

Check if one Monefy instance is less than another.

@param monefy [Monefy] another Monefy instance.

@return [Boolean] true if current instace is less than another and false if not.

@example

Monefy.new(50, 'EUR') < Monefy.new(40, 'EUR') # => false
Monefy.new(50, 'EUR') < Monefy.new(200, 'USD') # => true
# File lib/monefy/matchers.rb, line 63
def < monefy
  validate_monefy_instance(monefy)

  amount < converted_money_currency(monefy)
end
==(monefy) click to toggle source

Check if two distinct Monefy instances are equal.

@param monefy [Monefy] another Monefy instance.

@return [Boolean] true if both instances are equal and false if they are different.

@example

Monefy.new(50, 'EUR') == Monefy.new(40, 'EUR') # => false
Monefy.new(50, 'EUR') == Monefy.new(55.5, 'USD') # => true
# File lib/monefy/matchers.rb, line 15
def == monefy
  validate_monefy_instance(monefy)

  amount == converted_money_currency(monefy)
end
>(monefy) click to toggle source

Check if one Monefy instance is greater than another.

@param monefy [Monefy] another Monefy instance.

@return [Boolean] true if current instace is greater than another and false if not.

@example

Monefy.new(50, 'EUR') > Monefy.new(40, 'EUR') # => true
Monefy.new(50, 'EUR') > Monefy.new(200, 'USD') # => false
# File lib/monefy/matchers.rb, line 47
def > monefy
  validate_monefy_instance(monefy)

  amount > converted_money_currency(monefy)
end