vector2d 2.2.3 → 2.2.4

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.
@@ -1,76 +1,90 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  describe Vector2d do
6
- subject(:vector) { Vector2d.new(2, 3) }
6
+ subject(:vector) { described_class.new(2, 3) }
7
7
 
8
8
  shared_examples "a parsed vector" do |x, y|
9
- it "receives the x and y properties" do
9
+ it "receives the x property" do
10
10
  expect(subject.x).to eq(x)
11
+ end
12
+
13
+ it "receives the y property" do
11
14
  expect(subject.y).to eq(y)
12
15
  end
13
16
  end
14
17
 
15
18
  describe "helper method" do
16
19
  it "creates a vector" do
17
- expect(Vector2d(2, 3)).to eq(Vector2d.new(2, 3))
20
+ expect(Vector2d(2, 3)).to eq(described_class.new(2, 3))
18
21
  end
19
22
  end
20
23
 
21
24
  describe ".parse" do
22
25
  context "with fixnum argument" do
23
- subject(:vector) { Vector2d.parse(2) }
26
+ subject(:vector) { described_class.parse(2) }
27
+
24
28
  it_behaves_like "a parsed vector", [2, 2]
25
29
  end
26
30
 
27
31
  context "with two arguments, fixnum" do
28
- subject(:vector) { Vector2d.parse(1, 2) }
32
+ subject(:vector) { described_class.parse(1, 2) }
33
+
29
34
  it_behaves_like "a parsed vector", [1, 2]
30
35
  end
31
36
 
32
37
  context "with two arguments, float" do
33
- subject(:vector) { Vector2d.parse(1.0, 2.0) }
38
+ subject(:vector) { described_class.parse(1.0, 2.0) }
39
+
34
40
  it_behaves_like "a parsed vector", [1.0, 2.0]
35
41
  end
36
42
 
37
43
  context "with string argument, first omitted" do
38
- subject(:vector) { Vector2d.parse("x200") }
44
+ subject(:vector) { described_class.parse("x200") }
45
+
39
46
  it_behaves_like "a parsed vector", [0, 200]
40
47
  end
41
48
 
42
49
  context "with string argument, second omitted" do
43
- subject(:vector) { Vector2d.parse("200x") }
50
+ subject(:vector) { described_class.parse("200x") }
51
+
44
52
  it_behaves_like "a parsed vector", [200, 0]
45
53
  end
46
54
 
47
55
  context "with string argument, fixnum" do
48
- subject(:vector) { Vector2d.parse("1x2") }
56
+ subject(:vector) { described_class.parse("1x2") }
57
+
49
58
  it_behaves_like "a parsed vector", [1, 2]
50
59
  end
51
60
 
52
61
  context "with string argument, float" do
53
- subject(:vector) { Vector2d.parse("1.0x2.0") }
62
+ subject(:vector) { described_class.parse("1.0x2.0") }
63
+
54
64
  it_behaves_like "a parsed vector", [1.0, 2.0]
55
65
  end
56
66
 
57
67
  context "with array argument" do
58
- subject(:vector) { Vector2d.parse([1, 2]) }
68
+ subject(:vector) { described_class.parse([1, 2]) }
69
+
59
70
  it_behaves_like "a parsed vector", [1, 2]
60
71
  end
61
72
 
62
73
  context "with hash argument, symbol keys" do
63
- subject(:vector) { Vector2d.parse({:x => 1, :y => 2}) }
74
+ subject(:vector) { described_class.parse(x: 1, y: 2) }
75
+
64
76
  it_behaves_like "a parsed vector", [1, 2]
65
77
  end
66
78
 
67
79
  context "with hash argument, string keys" do
68
- subject(:vector) { Vector2d.parse({'x' => 1, 'y' => 2}) }
80
+ subject(:vector) { described_class.parse("x" => 1, "y" => 2) }
81
+
69
82
  it_behaves_like "a parsed vector", [1, 2]
70
83
  end
71
84
 
72
85
  context "with vector argument" do
73
- subject(:vector) { Vector2d.parse(Vector2d.new(1, 2)) }
86
+ subject(:vector) { described_class.parse(described_class.new(1, 2)) }
87
+
74
88
  it_behaves_like "a parsed vector", [1, 2]
75
89
  end
76
90
  end
@@ -79,18 +93,21 @@ describe Vector2d do
79
93
  subject { vector == comp }
80
94
 
81
95
  context "with both arguments equal" do
82
- let(:comp) { Vector2d.new(2, 3) }
83
- it { is_expected.to eq(true) }
96
+ let(:comp) { described_class.new(2, 3) }
97
+
98
+ it { is_expected.to be(true) }
84
99
  end
85
100
 
86
101
  context "with x differing" do
87
- let(:comp) { Vector2d.new(3, 3) }
88
- it { is_expected.to eq(false) }
102
+ let(:comp) { described_class.new(3, 3) }
103
+
104
+ it { is_expected.to be(false) }
89
105
  end
90
106
 
91
107
  context "with y differing" do
92
- let(:comp) { Vector2d.new(2, 4) }
93
- it { is_expected.to eq(false) }
108
+ let(:comp) { described_class.new(2, 4) }
109
+
110
+ it { is_expected.to be(false) }
94
111
  end
95
112
  end
96
113
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- require "codeclimate-test-reporter"
4
- CodeClimate::TestReporter.start
3
+ require "simplecov"
4
+ SimpleCov.start
5
5
 
6
- require "vector2d"
6
+ require "vector2d"
7
+ require "rspec/its"
data/vector2d.gemspec CHANGED
@@ -1,31 +1,26 @@
1
- # coding: utf-8
2
- # Generated by jeweler
3
- # DO NOT EDIT THIS FILE DIRECTLY
4
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
5
- # -*- encoding: utf-8 -*-
1
+ # frozen_string_literal: true
6
2
 
7
- $:.push File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.push File.expand_path("lib", __dir__)
8
4
  require "vector2d/version"
9
5
 
10
6
  Gem::Specification.new do |s|
11
- s.name = %q{vector2d}
7
+ s.name = "vector2d"
12
8
  s.version = Vector2d::VERSION
13
9
  s.authors = ["Inge Jørgensen"]
14
10
  s.email = ["inge@elektronaut.no"]
15
- s.homepage = %q{http://github.com/elektronaut/vector2d}
16
- s.summary = %q{Library for handling two-dimensional vectors}
17
- s.description = %q{Vector2d allows for easy handling of two-dimensionals coordinates and vectors}
11
+ s.homepage = "http://github.com/elektronaut/vector2d"
12
+ s.summary = "Library for handling two-dimensional vectors"
13
+ s.description = "Vector2d allows for easy handling of two-dimensional " \
14
+ "coordinates and vectors"
18
15
  s.license = "MIT"
19
16
 
20
17
  s.files = `git ls-files`.split("\n")
21
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.executables = `git ls-files -- bin/*`
19
+ .split("\n")
20
+ .map { |f| File.basename(f) }
23
21
  s.require_paths = ["lib"]
24
22
 
25
- s.required_ruby_version = '>= 1.9.2'
23
+ s.required_ruby_version = ">= 2.7.0"
26
24
 
27
- # specify any dependencies here; for example:
28
- s.add_development_dependency "rake", "~> 10.3"
29
- s.add_development_dependency "rspec", "~> 3.2"
30
- s.add_dependency "contracts", "~> 0.9.0"
25
+ s.metadata["rubygems_mfa_required"] = "true"
31
26
  end
metadata CHANGED
@@ -1,58 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vector2d
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inge Jørgensen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-20 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '10.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '10.3'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '3.2'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '3.2'
41
- - !ruby/object:Gem::Dependency
42
- name: contracts
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.9.0
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.9.0
55
- description: Vector2d allows for easy handling of two-dimensionals coordinates and
11
+ date: 2023-02-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Vector2d allows for easy handling of two-dimensional coordinates and
56
14
  vectors
57
15
  email:
58
16
  - inge@elektronaut.no
@@ -60,7 +18,9 @@ executables: []
60
18
  extensions: []
61
19
  extra_rdoc_files: []
62
20
  files:
21
+ - ".github/workflows/build.yml"
63
22
  - ".gitignore"
23
+ - ".rubocop.yml"
64
24
  - ".travis.yml"
65
25
  - Gemfile
66
26
  - Gemfile.lock
@@ -85,8 +45,9 @@ files:
85
45
  homepage: http://github.com/elektronaut/vector2d
86
46
  licenses:
87
47
  - MIT
88
- metadata: {}
89
- post_install_message:
48
+ metadata:
49
+ rubygems_mfa_required: 'true'
50
+ post_install_message:
90
51
  rdoc_options: []
91
52
  require_paths:
92
53
  - lib
@@ -94,23 +55,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
55
  requirements:
95
56
  - - ">="
96
57
  - !ruby/object:Gem::Version
97
- version: 1.9.2
58
+ version: 2.7.0
98
59
  required_rubygems_version: !ruby/object:Gem::Requirement
99
60
  requirements:
100
61
  - - ">="
101
62
  - !ruby/object:Gem::Version
102
63
  version: '0'
103
64
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.4.5
106
- signing_key:
65
+ rubygems_version: 3.4.6
66
+ signing_key:
107
67
  specification_version: 4
108
68
  summary: Library for handling two-dimensional vectors
109
- test_files:
110
- - spec/lib/vector2d/calculations_spec.rb
111
- - spec/lib/vector2d/coercions_spec.rb
112
- - spec/lib/vector2d/fitting_spec.rb
113
- - spec/lib/vector2d/properties_spec.rb
114
- - spec/lib/vector2d/transformations_spec.rb
115
- - spec/lib/vector2d_spec.rb
116
- - spec/spec_helper.rb
69
+ test_files: []