Class: Kosher::Offer

Inherits:
Structure
  • Object
show all
Includes:
Comparable
Defined in:
lib/kosher/offer.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/kosher/offer.rb', line 11

def <=>(other)
  if kosher? != other.kosher?
    kosher? ? -1 : 1
  else
    price <=> other.price
  end
end

#kosher?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/kosher/offer.rb', line 19

def kosher?
  condition.kosher? && seller.kosher? && shipping.available?
end

#priceObject



23
24
25
# File 'lib/kosher/offer.rb', line 23

def price
  unit.price + shipping.cost
end