class Centra::Rule::OrderCompare

Attributes

order[R]

Public Class Methods

allowed_delay_in_minutes() click to toggle source
# File lib/centra/rule/order_compare.rb, line 6
def self.allowed_delay_in_minutes
  @@allowed_delay_in_minutes
end
allowed_delay_in_minutes=(mins) click to toggle source
# File lib/centra/rule/order_compare.rb, line 10
def self.allowed_delay_in_minutes=(mins)
  @@allowed_delay_in_minutes = mins
end
new(order, allowed_delay_in_minutes: self.class.allowed_delay_in_minutes) click to toggle source
# File lib/centra/rule/order_compare.rb, line 18
def initialize(order, allowed_delay_in_minutes: self.class.allowed_delay_in_minutes)
  @order = order
  @allowed_delay_in_minutes = allowed_delay_in_minutes
end

Public Instance Methods

==(other) click to toggle source
# File lib/centra/rule/order_compare.rb, line 23
def ==(other)
  return false if order.email != other.email
  return false if order.delay_in_seconds(other) > allowed_delay_in_seconds

  true
end
allowed_delay_in_seconds() click to toggle source
# File lib/centra/rule/order_compare.rb, line 30
def allowed_delay_in_seconds
  60 * @allowed_delay_in_minutes
end