Class: SpaceCalculator
- Inherits:
-
Object
- Object
- SpaceCalculator
- Defined in:
- backend/app/model/space_calculator.rb
Defined Under Namespace
Classes: Dimensions, LocationContainerLookup, LocationPacker, MissingDimensionException, UnsupportedUnitException
Constant Summary collapse
- MAX_CONTAINERS_TO_PACK =
99999
Instance Attribute Summary collapse
-
#units ⇒ Object
readonly
Returns the value of attribute units.
Instance Method Summary collapse
-
#initialize(container_profile, locations) ⇒ SpaceCalculator
constructor
A new instance of SpaceCalculator.
-
#to_hash ⇒ Object
Constructor Details
#initialize(container_profile, locations) ⇒ SpaceCalculator
Returns a new instance of SpaceCalculator.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'backend/app/model/space_calculator.rb', line 13 def initialize(container_profile, locations) @container_profile = container_profile @locations = locations @total_spaces_available = 0 @total_containers_of_type = 0 @locations_with_space = [] @locations_without_space = [] @uncalculatable_locations = [] calculate end |
Instance Attribute Details
#units ⇒ Object (readonly)
Returns the value of attribute units
11 12 13 |
# File 'backend/app/model/space_calculator.rb', line 11 def units @units end |
Instance Method Details
#to_hash ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'backend/app/model/space_calculator.rb', line 26 def to_hash { 'container_profile' => {'ref' => @container_profile.uri}, 'total_spaces_available' => @total_spaces_available, 'total_containers_of_type' => @total_containers_of_type, 'locations_with_space' => @locations_with_space, 'locations_without_space' => @locations_without_space, 'uncalculatable_locations' => @uncalculatable_locations } end |