vector2d 2.2.2 → 2.2.3

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: 0a82d0292fef3b582e52bc5277e0f646a7c478e6
4
- data.tar.gz: b0c9b2d39826972750cd0fc541c68f805214fb2e
3
+ metadata.gz: 7dbfd81a3fed2f7614e10055078fdbdd37755693
4
+ data.tar.gz: e3e0f41142cba937a0eba3a16b94a33ebd8d3a7e
5
5
  SHA512:
6
- metadata.gz: 0954a69a9c7d2a1d26edf9e4b54a709dd792d9f80977cd27aaab7665d5380814135be3bd35f2d25614b58e1e1d31c23bacb6aefc4e12c57dc05e778837de119a
7
- data.tar.gz: de5702b4a8f2ae44ca796d7dfb828527f9b1d28649ca6f3d545b3356cb4b40dc21366420d5e5aec818641c75b752acd36e208cddc4a6c79588e963d9a779f7fe
6
+ metadata.gz: 526d578d2c1ca5b1c47c7e5552b0fd7493188ac58bf80a21768d5c2e0ce42baab3bbbd22e256c16561f30546c8cdf3aa46426857713da6494c27809171e3cedb
7
+ data.tar.gz: 5a139955b82cee23628966909c1dd8d12e46e7e8bafc539c48c9339e57fddc43bdf1712345f1576b5998a103a44df4fc1b220ace19b1b96cf8498b18ff776a87
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vector2d (2.2.2)
4
+ vector2d (2.2.3)
5
5
  contracts (~> 0.9.0)
6
6
 
7
7
  GEM
@@ -78,9 +78,10 @@ class Vector2d
78
78
  Contract String => Vector2d
79
79
  def parse_str(str)
80
80
  if str =~ /^[\s]*[\d\.]*[\s]*x[\s]*[\d\.]*[\s]*$/
81
- self.new(*str.split("x").map(&:to_f))
81
+ x, y = str.split("x")
82
+ new(x.to_f, y.to_f)
82
83
  else
83
- raise ArgumentError, "not a valid string input"
84
+ fail ArgumentError, "not a valid string input"
84
85
  end
85
86
  end
86
87
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Vector2d
4
- VERSION = "2.2.2"
4
+ VERSION = "2.2.3"
5
5
  end
@@ -34,6 +34,16 @@ describe Vector2d do
34
34
  it_behaves_like "a parsed vector", [1.0, 2.0]
35
35
  end
36
36
 
37
+ context "with string argument, first omitted" do
38
+ subject(:vector) { Vector2d.parse("x200") }
39
+ it_behaves_like "a parsed vector", [0, 200]
40
+ end
41
+
42
+ context "with string argument, second omitted" do
43
+ subject(:vector) { Vector2d.parse("200x") }
44
+ it_behaves_like "a parsed vector", [200, 0]
45
+ end
46
+
37
47
  context "with string argument, fixnum" do
38
48
  subject(:vector) { Vector2d.parse("1x2") }
39
49
  it_behaves_like "a parsed vector", [1, 2]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vector2d
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inge Jørgensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-10 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake