Class: Comable::Inventory::Adjuster

Inherits:
Object
  • Object
show all
Defined in:
app/models/comable/inventory/adjuster.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(packages, units) ⇒ Adjuster

Returns a new instance of Adjuster.



7
8
9
10
# File 'app/models/comable/inventory/adjuster.rb', line 7

def initialize(packages, units)
  @packages = packages.map(&:clone)
  @units = units
end

Instance Attribute Details

#packagesObject

Returns the value of attribute packages.



4
5
6
# File 'app/models/comable/inventory/adjuster.rb', line 4

def packages
  @packages
end

#unitsObject

Returns the value of attribute units.



5
6
7
# File 'app/models/comable/inventory/adjuster.rb', line 5

def units
  @units
end

Instance Method Details

#adjusted_packagesObject



12
13
14
15
# File 'app/models/comable/inventory/adjuster.rb', line 12

def adjusted_packages
  remove_duplicated_items
  packages
end