Module: Comable::Variant::Quantifier

Included in:
Comable::Variant
Defined in:
app/models/comable/variant/quantifier.rb

Instance Method Summary collapse

Instance Method Details

#backorderable?Boolean

TODO: Implement

Returns:

  • (Boolean)


22
23
24
# File 'app/models/comable/variant/quantifier.rb', line 22

def backorderable?
  false
end

#can_supply?(required = 1) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/models/comable/variant/quantifier.rb', line 12

def can_supply?(required = 1)
  quantity >= required || backorderable?
end

#total_quantityObject



4
5
6
7
8
9
10
# File 'app/models/comable/variant/quantifier.rb', line 4

def total_quantity
  if track_inventory?
    stocks.to_a.sum(&:quantity)
  else
    Float::INFINITY
  end
end

#track_inventory?Boolean

TODO: Implement

Returns:

  • (Boolean)


17
18
19
# File 'app/models/comable/variant/quantifier.rb', line 17

def track_inventory?
  true
end