boxxer 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/lib/boxxer.rb +5 -1
- data/lib/boxxer/container.rb +1 -5
- data/lib/boxxer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b7e811efc5e8e1f0174ca7a17f40e2b2d403a423865d8801819a94529b5b516
|
4
|
+
data.tar.gz: f408183b37c85b424ef44313abdb88e0c8e7be85d8a45387a68df6f35834b471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76ed9132a602c27ea74124d60af143ce11fcc405942ed7f57078bed334acd2632d4a6191baea34829bbd158c76ebb6c923becca51452a74093c7e617b6f777ea
|
7
|
+
data.tar.gz: c4f7408c2d0f14f2e684e1a2c26593215fa4f695abe2a7f3ffc37b2fa76e95507b06255d2ac929160833310f6c98310bb77d5c820d2c32cab7960a566aefc4fc
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,12 @@ This gem intended to pick containers(boxes, packages, cartons), based on item we
|
|
5
5
|
## Usage
|
6
6
|
|
7
7
|
```
|
8
|
+
gem install boxxer
|
9
|
+
irb
|
10
|
+
```
|
11
|
+
|
12
|
+
```
|
13
|
+
require 'boxxer'
|
8
14
|
weights = []
|
9
15
|
20.times { weights << rand(0.5..1).round(3) }
|
10
16
|
containers = [{ length: 47, width: 38, height: 10, tare_weight: 0.019, net_limit: 0.481 },
|
data/lib/boxxer.rb
CHANGED
@@ -5,7 +5,7 @@ module Boxxer
|
|
5
5
|
class Error < StandardError; end
|
6
6
|
|
7
7
|
class Arranger
|
8
|
-
attr_reader :containers, :container_count
|
8
|
+
attr_reader :containers, :container_count, :containers_gross_weight
|
9
9
|
|
10
10
|
def initialize(containers:, weights:)
|
11
11
|
@available_containers = containers.sort { |container| container[:net_limit] }.reverse
|
@@ -25,6 +25,10 @@ module Boxxer
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
+
def containers_gross_weight
|
29
|
+
@containers.sum(&:gross_weight)
|
30
|
+
end
|
31
|
+
|
28
32
|
def container_count
|
29
33
|
@containers.count
|
30
34
|
end
|
data/lib/boxxer/container.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Boxxer
|
2
2
|
class Container
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :tare_weight, :net_weight, :gross_weight, :weidth, :height, :length
|
4
4
|
attr_writer :weights
|
5
5
|
|
6
6
|
def initialize(width:, height:, length:, tare_weight:, net_limit:)
|
@@ -12,10 +12,6 @@ module Boxxer
|
|
12
12
|
@weights = []
|
13
13
|
end
|
14
14
|
|
15
|
-
def dimensions
|
16
|
-
{ width: width, height: height, length: length }
|
17
|
-
end
|
18
|
-
|
19
15
|
def net_weight
|
20
16
|
(@weights.sum).truncate(3)
|
21
17
|
end
|
data/lib/boxxer/version.rb
CHANGED