box_packer 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 959809e7eac3a76e95054ec7eccbc68e91ad1794
4
- data.tar.gz: 898284b8f4dfee101bb8df784ed2f26787ef8aa0
3
+ metadata.gz: eba591c80a0ed22630cab9bb8ae6f6c4f61f8a4e
4
+ data.tar.gz: a078c724e6cb21db22d3d5937a635bf8bd5cee28
5
5
  SHA512:
6
- metadata.gz: 452b2949f4716224416ebcfe8ca91d56eeb1866086c9edaa638f901f2709ca0d1353f179471d5d462639325a77e52a6fa97fa5e0d6553bed29c8dd57ccea6ddc
7
- data.tar.gz: d8c849a45ab956d649bea7e2d84db8ce81fba6baee0d196a17ebfe40ed1d9058376ae8955624108610ac372911a61afc65e0539fdb4478bd689afb11a0dca3bc
6
+ metadata.gz: 4db6ea115a0c889b38f6308c3ac6904c22afeeffdce30e46c21de198da49ec81d6789bff75fb25b41632091f2e74840a6a497a1dd93d1d8fe37d7fc3da009f3b
7
+ data.tar.gz: 0c79d3e330a252443148c7e6b92ae3ac255afe1140a59f801b6bc225d19ac547dfc725f6c906bdd5996b77020e6003687d5709cf23776cfb4f60290a3df5831e
@@ -1,6 +1,7 @@
1
1
  require 'attr_extras'
2
2
  require 'forwardable'
3
3
  require_relative 'position'
4
+ require_relative 'dimensions'
4
5
 
5
6
  module BoxPacker
6
7
  class Box
@@ -47,6 +47,7 @@ module BoxPacker
47
47
  packings.count
48
48
  else
49
49
  @packings = []
50
+ false
50
51
  end
51
52
  end
52
53
 
@@ -3,6 +3,14 @@ require 'matrix'
3
3
  module BoxPacker
4
4
  class Dimensions < Vector
5
5
 
6
+ def +(d)
7
+ Dimensions[*super]
8
+ end
9
+
10
+ def -(d)
11
+ Dimensions[*super]
12
+ end
13
+
6
14
  def width
7
15
  Dimensions[self[0], 0, 0]
8
16
  end
@@ -1,3 +1,3 @@
1
1
  module BoxPacker
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -24,7 +24,7 @@ module BoxPacker
24
24
  Dimensions[10, 9, 9]
25
25
  ]}
26
26
 
27
- it { expect(items.map(&:dimensions)).to eql(expected_dimensions) }
27
+ it { expect(container.items.map(&:dimensions)).to eql(expected_dimensions) }
28
28
  it { expect(container.packings).to eql([]) }
29
29
  end
30
30
 
@@ -58,7 +58,7 @@ module BoxPacker
58
58
  end
59
59
 
60
60
  context 'with an item to large' do
61
- before { items[0].dimensions = Dimensions[26, 34, 8] }
61
+ before { container.items[0].dimensions = Dimensions[26, 34, 8] }
62
62
  it { expect(container.send(:packable?)).to be(false) }
63
63
  end
64
64
 
@@ -50,7 +50,7 @@ module BoxPacker
50
50
  end
51
51
 
52
52
  it do
53
- expect(container.pack!).to eql(0)
53
+ expect(container.pack!).to be(false)
54
54
  expect(container.packed_successfully).to be(false)
55
55
  end
56
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: box_packer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max White
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-03 00:00:00.000000000 Z
11
+ date: 2014-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler