versionaire 7.0.0 → 7.1.0

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
  SHA256:
3
- metadata.gz: 1e015fa264c36d4e42f1300b90df8c253e5d55d3af04d0fa1ec49028d0073360
4
- data.tar.gz: 72b461b147c85e4035fb284a0c9b37a4e8663d77fa774f3141344a44b1f16df8
3
+ metadata.gz: ee0ca3727b5bf31067191d7aa4be767dee8d3b7e6c2703d211aa6cc9927c4021
4
+ data.tar.gz: ea9ce213190cfe550585441125de1bbb4f327fa99263b06bc20ab7736fe4fc66
5
5
  SHA512:
6
- metadata.gz: 566f172dacd7caf1cd90ec90863007ad66bb5b13247941dcf92757f219eeb7d158aacfed5ee59e91d6d4225a528eed7a33ee3f2a7a216d206a06794492f07f4e
7
- data.tar.gz: 4731da593a494b3e326e2402dc9733cfaf48a6df3bf533c7f9aad0da13aa493a21d37214ccf79fc58cbcdff5da3acbc16b4cfaf111d70d00503e972ac8d188b8
6
+ metadata.gz: 4d151a766961b4a96d136ebaf66f6ca8b44dbaf50d5037f7d648f380d217e8bb8cf5d9c72def4fa6d234465aec5eb592ca3193b0d08ab9f7645daac4301c8662
7
+ data.tar.gz: 9a949b67e45eb87e856f2f256e63dfdb0ff274cd8696ea353d5b6f99f90b350c34e74407656764065533a493417b2303acb0300a762da51a209c8298cd06d064
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -64,7 +64,7 @@ module Versionaire
64
64
  end
65
65
 
66
66
  def required_keys?
67
- value.keys.all? { |key| Version::KEYS.include? key }
67
+ value.keys.all? { |key| VERSION_ATTRIBUTES.include? key }
68
68
  end
69
69
 
70
70
  def error_message object, body
@@ -12,7 +12,7 @@ module Versionaire
12
12
  end
13
13
 
14
14
  def self.version
15
- "7.0.0"
15
+ "7.1.0"
16
16
  end
17
17
 
18
18
  def self.version_label
@@ -1,34 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Versionaire
4
- # An immutable, semantic version value object.
5
- class Version
6
- include Comparable
7
- attr_reader :major, :minor, :maintenance
8
-
9
- KEYS = %i[major minor maintenance].freeze
10
- DELIMITER = "."
4
+ VERSION_ATTRIBUTES = %i[major minor maintenance].freeze
5
+ VERSION_DELIMITER = "."
11
6
 
7
+ # An immutable, semantic version value object.
8
+ # rubocop:disable Metrics/BlockLength
9
+ Version = Struct.new :major, :minor, :maintenance, keyword_init: true do
12
10
  def self.regex
13
11
  /
14
- \A # Start of string.
15
- \d{1,} # Major version.
16
- #{DELIMITER} # Delimiter.
17
- \d{1,} # Minor version.
18
- #{DELIMITER} # Delimiter.
19
- \d{1,} # Maintenance version.
20
- \z # End of string.
12
+ \A # Start of string.
13
+ \d{1,} # Major version.
14
+ #{VERSION_DELIMITER} # Delimiter.
15
+ \d{1,} # Minor version.
16
+ #{VERSION_DELIMITER} # Delimiter.
17
+ \d{1,} # Maintenance version.
18
+ \z # End of string.
21
19
  /x
22
20
  end
23
21
 
24
22
  def self.arguments major, minor, maintenance
25
- Hash[KEYS.zip [major, minor, maintenance]]
23
+ Hash[VERSION_ATTRIBUTES.zip [major, minor, maintenance]]
26
24
  end
27
25
 
28
26
  def initialize major: 0, minor: 0, maintenance: 0
29
- @major = major
30
- @minor = minor
31
- @maintenance = maintenance
27
+ super
32
28
  validate
33
29
  freeze
34
30
  end
@@ -43,35 +39,20 @@ module Versionaire
43
39
  klass.new klass.arguments(*reduce(other, :-))
44
40
  end
45
41
 
46
- # :reek:FeatureEnvy
47
- def == other
48
- other.is_a?(Version) && to_s == other.to_s
49
- end
50
-
51
- alias eql? ==
52
-
53
42
  def <=> other
54
43
  to_s <=> other.to_s
55
44
  end
56
45
 
57
- def hash
58
- [major, minor, maintenance, self.class].hash
59
- end
60
-
61
46
  def to_s
62
- [major, minor, maintenance].join self.class::DELIMITER
47
+ [major, minor, maintenance].join VERSION_DELIMITER
63
48
  end
64
49
 
65
- alias to_str to_s
50
+ alias_method :to_str, :to_s
66
51
 
67
52
  def to_a
68
53
  [major, minor, maintenance]
69
54
  end
70
55
 
71
- def to_h
72
- {major: major, minor: minor, maintenance: maintenance}
73
- end
74
-
75
56
  private
76
57
 
77
58
  def validate
@@ -83,4 +64,5 @@ module Versionaire
83
64
  to_a.zip(other.to_a).map { |pair| pair.reduce(action) }
84
65
  end
85
66
  end
67
+ # rubocop:enable Metrics/BlockLength
86
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versionaire
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -29,7 +29,7 @@ cert_chain:
29
29
  4Zrsxi713z6sndd9JBAm4G7mJiV93MsuCM5N4ZDY7XaxIhvctNSNhX/Yn8LLdtGI
30
30
  b4jw5t40FKyNUvLPPXYAvQALBtk=
31
31
  -----END CERTIFICATE-----
32
- date: 2019-01-01 00:00:00.000000000 Z
32
+ date: 2019-02-02 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: awesome_print
@@ -73,6 +73,34 @@ dependencies:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.6'
76
+ - !ruby/object:Gem::Dependency
77
+ name: gemsmith
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '13.0'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '13.0'
90
+ - !ruby/object:Gem::Dependency
91
+ name: git-cop
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
76
104
  - !ruby/object:Gem::Dependency
77
105
  name: guard-rspec
78
106
  requirement: !ruby/object:Gem::Requirement
@@ -177,14 +205,14 @@ dependencies:
177
205
  requirements:
178
206
  - - "~>"
179
207
  - !ruby/object:Gem::Version
180
- version: '0.62'
208
+ version: '0.63'
181
209
  type: :development
182
210
  prerelease: false
183
211
  version_requirements: !ruby/object:Gem::Requirement
184
212
  requirements:
185
213
  - - "~>"
186
214
  - !ruby/object:Gem::Version
187
- version: '0.62'
215
+ version: '0.63'
188
216
  - !ruby/object:Gem::Dependency
189
217
  name: rubocop-rspec
190
218
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- �x��v3^_N6ֹ���p3Vy_Z8�ل��o���#���*�p���ũ�{ԟ5�ܺk��S��rVv�?��^�np ��VA���Q���΋�޽_�TE�<�o�<��$���[OFa����I�����Β�]^ af��.����T9�W���{̆ $y��LV{��,�dh~Jù$͓�h!�Ԋ�G����D��cu��S���xQ=
2
- ��r��a^��?t���u_ ��V
1
+ l����\�o����%{��uܳ�yv���w�� �w����?���)nKM�z�$�ܨ\��}����h�$p�֭sP{j�~�f�5��՗۬�8+�,\��چ����������6}⮷���+Zq˧����� .8�x����������>c��\�K��J��i�=u���c�10 6��I��3*D0{�#d0[%�;r<�8Df����Xk�ʥ߿a[W�F��#��������CML�>�'�