ruby-units 4.0.1 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/Gemfile.lock +49 -48
- data/lib/ruby_units/unit.rb +17 -3
- data/lib/ruby_units/unit_definitions/standard.rb +5 -2
- data/lib/ruby_units/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2371b3ae13f46ce73b204bbbc66d9bdcd91e10a1acc890e7ef532c774a530d64
|
4
|
+
data.tar.gz: 16ebec59108aa9e7ac93cbb09c7610744c2f8aa39263a2069aba3999f4414e12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fdfb41ee29400a9686c8555b41d2439b6e77b0f727a1a845e456e9625e91d86ded9c8bf55a745ebedb3eb1533f427f05e3b21625918b8a5c9bd8070ac837dd4
|
7
|
+
data.tar.gz: 616b0c7479d9e07d1fedb70539b13e4ff108157ef891f2bcf2de2dedfae02d04964c7876aec69eba51bf881e8295c2e5d30ffc425e9ce79b32a6ba84be8f268f
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby-units (4.0.
|
4
|
+
ruby-units (4.0.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.2)
|
10
10
|
backport (1.2.0)
|
11
|
-
benchmark (0.
|
11
|
+
benchmark (0.3.0)
|
12
12
|
coderay (1.1.3)
|
13
|
-
debug (1.
|
14
|
-
irb (
|
15
|
-
reline (>= 0.3.
|
16
|
-
diff-lcs (1.5.
|
13
|
+
debug (1.9.1)
|
14
|
+
irb (~> 1.10)
|
15
|
+
reline (>= 0.3.8)
|
16
|
+
diff-lcs (1.5.1)
|
17
17
|
docile (1.4.0)
|
18
18
|
e2mmap (0.1.0)
|
19
19
|
ffi (1.16.3)
|
@@ -33,16 +33,16 @@ GEM
|
|
33
33
|
guard (~> 2.1)
|
34
34
|
guard-compat (~> 1.1)
|
35
35
|
rspec (>= 2.99.0, < 4.0)
|
36
|
-
io-console (0.
|
37
|
-
io-console (0.
|
38
|
-
irb (1.
|
36
|
+
io-console (0.7.2)
|
37
|
+
io-console (0.7.2-java)
|
38
|
+
irb (1.11.1)
|
39
39
|
rdoc
|
40
|
-
reline (>= 0.
|
40
|
+
reline (>= 0.4.2)
|
41
41
|
jar-dependencies (0.4.1)
|
42
42
|
jaro_winkler (1.5.6)
|
43
43
|
jaro_winkler (1.5.6-java)
|
44
|
-
json (2.
|
45
|
-
json (2.
|
44
|
+
json (2.7.1)
|
45
|
+
json (2.7.1-java)
|
46
46
|
kramdown (2.4.0)
|
47
47
|
rexml
|
48
48
|
kramdown-parser-gfm (1.1.0)
|
@@ -51,22 +51,22 @@ GEM
|
|
51
51
|
listen (3.8.0)
|
52
52
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
53
53
|
rb-inotify (~> 0.9, >= 0.9.10)
|
54
|
-
lumberjack (1.2.
|
54
|
+
lumberjack (1.2.10)
|
55
55
|
method_source (1.0.0)
|
56
56
|
nenv (0.3.0)
|
57
|
-
nokogiri (1.
|
57
|
+
nokogiri (1.16.2-arm64-darwin)
|
58
58
|
racc (~> 1.4)
|
59
|
-
nokogiri (1.
|
59
|
+
nokogiri (1.16.2-java)
|
60
60
|
racc (~> 1.4)
|
61
|
-
nokogiri (1.
|
61
|
+
nokogiri (1.16.2-x86_64-darwin)
|
62
62
|
racc (~> 1.4)
|
63
|
-
nokogiri (1.
|
63
|
+
nokogiri (1.16.2-x86_64-linux)
|
64
64
|
racc (~> 1.4)
|
65
65
|
notiffany (0.1.3)
|
66
66
|
nenv (~> 0.1)
|
67
67
|
shellany (~> 0.0)
|
68
|
-
parallel (1.
|
69
|
-
parser (3.
|
68
|
+
parallel (1.24.0)
|
69
|
+
parser (3.3.0.5)
|
70
70
|
ast (~> 2.4.1)
|
71
71
|
racc
|
72
72
|
pry (0.14.2)
|
@@ -76,67 +76,67 @@ GEM
|
|
76
76
|
coderay (~> 1.1)
|
77
77
|
method_source (~> 1.0)
|
78
78
|
spoon (~> 0.0)
|
79
|
-
psych (5.1.
|
79
|
+
psych (5.1.2)
|
80
80
|
stringio
|
81
|
-
psych (5.1.
|
81
|
+
psych (5.1.2-java)
|
82
82
|
jar-dependencies (>= 0.1.7)
|
83
|
-
racc (1.7.
|
84
|
-
racc (1.7.
|
83
|
+
racc (1.7.3)
|
84
|
+
racc (1.7.3-java)
|
85
85
|
rainbow (3.1.1)
|
86
86
|
rake (13.1.0)
|
87
87
|
rb-fsevent (0.11.2)
|
88
88
|
rb-inotify (0.10.1)
|
89
89
|
ffi (~> 1.0)
|
90
90
|
rbs (2.8.4)
|
91
|
-
rdoc (6.
|
91
|
+
rdoc (6.6.2)
|
92
92
|
psych (>= 4.0.0)
|
93
93
|
redcarpet (3.6.0)
|
94
|
-
regexp_parser (2.
|
95
|
-
reline (0.
|
94
|
+
regexp_parser (2.9.0)
|
95
|
+
reline (0.4.2)
|
96
96
|
io-console (~> 0.5)
|
97
97
|
reverse_markdown (2.1.1)
|
98
98
|
nokogiri
|
99
99
|
rexml (3.2.6)
|
100
|
-
rspec (3.
|
101
|
-
rspec-core (~> 3.
|
102
|
-
rspec-expectations (~> 3.
|
103
|
-
rspec-mocks (~> 3.
|
104
|
-
rspec-core (3.
|
105
|
-
rspec-support (~> 3.
|
106
|
-
rspec-expectations (3.
|
100
|
+
rspec (3.13.0)
|
101
|
+
rspec-core (~> 3.13.0)
|
102
|
+
rspec-expectations (~> 3.13.0)
|
103
|
+
rspec-mocks (~> 3.13.0)
|
104
|
+
rspec-core (3.13.0)
|
105
|
+
rspec-support (~> 3.13.0)
|
106
|
+
rspec-expectations (3.13.0)
|
107
107
|
diff-lcs (>= 1.2.0, < 2.0)
|
108
|
-
rspec-support (~> 3.
|
109
|
-
rspec-mocks (3.
|
108
|
+
rspec-support (~> 3.13.0)
|
109
|
+
rspec-mocks (3.13.0)
|
110
110
|
diff-lcs (>= 1.2.0, < 2.0)
|
111
|
-
rspec-support (~> 3.
|
112
|
-
rspec-support (3.
|
113
|
-
rubocop (1.
|
111
|
+
rspec-support (~> 3.13.0)
|
112
|
+
rspec-support (3.13.0)
|
113
|
+
rubocop (1.60.2)
|
114
114
|
json (~> 2.3)
|
115
115
|
language_server-protocol (>= 3.17.0)
|
116
116
|
parallel (~> 1.10)
|
117
|
-
parser (>= 3.
|
117
|
+
parser (>= 3.3.0.2)
|
118
118
|
rainbow (>= 2.2.2, < 4.0)
|
119
119
|
regexp_parser (>= 1.8, < 3.0)
|
120
120
|
rexml (>= 3.2.5, < 4.0)
|
121
|
-
rubocop-ast (>= 1.
|
121
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
122
122
|
ruby-progressbar (~> 1.7)
|
123
123
|
unicode-display_width (>= 2.4.0, < 3.0)
|
124
124
|
rubocop-ast (1.30.0)
|
125
125
|
parser (>= 3.2.1.0)
|
126
|
-
rubocop-capybara (2.
|
126
|
+
rubocop-capybara (2.20.0)
|
127
|
+
rubocop (~> 1.41)
|
128
|
+
rubocop-factory_bot (2.25.1)
|
127
129
|
rubocop (~> 1.41)
|
128
|
-
rubocop-factory_bot (2.24.0)
|
129
|
-
rubocop (~> 1.33)
|
130
130
|
rubocop-rake (0.6.0)
|
131
131
|
rubocop (~> 1.0)
|
132
|
-
rubocop-rspec (2.
|
132
|
+
rubocop-rspec (2.26.1)
|
133
133
|
rubocop (~> 1.40)
|
134
134
|
rubocop-capybara (~> 2.17)
|
135
135
|
rubocop-factory_bot (~> 2.22)
|
136
136
|
ruby-maven (3.3.13)
|
137
137
|
ruby-maven-libs (~> 3.3.9)
|
138
138
|
ruby-maven-libs (3.3.9)
|
139
|
-
ruby-prof (1.
|
139
|
+
ruby-prof (1.7.0)
|
140
140
|
ruby-progressbar (1.13.0)
|
141
141
|
shellany (0.0.1)
|
142
142
|
simplecov (0.22.0)
|
@@ -145,7 +145,7 @@ GEM
|
|
145
145
|
simplecov_json_formatter (~> 0.1)
|
146
146
|
simplecov-html (0.12.3)
|
147
147
|
simplecov_json_formatter (0.1.4)
|
148
|
-
solargraph (0.
|
148
|
+
solargraph (0.50.0)
|
149
149
|
backport (~> 1.2)
|
150
150
|
benchmark
|
151
151
|
bundler (~> 2.0)
|
@@ -163,7 +163,7 @@ GEM
|
|
163
163
|
yard (~> 0.9, >= 0.9.24)
|
164
164
|
spoon (0.0.6)
|
165
165
|
ffi
|
166
|
-
stringio (3.0
|
166
|
+
stringio (3.1.0)
|
167
167
|
terminal-notifier (2.0.0)
|
168
168
|
terminal-notifier-guard (1.7.0)
|
169
169
|
thor (1.3.0)
|
@@ -175,6 +175,7 @@ GEM
|
|
175
175
|
PLATFORMS
|
176
176
|
arm64-darwin-21
|
177
177
|
arm64-darwin-22
|
178
|
+
arm64-darwin-23
|
178
179
|
java
|
179
180
|
universal-java-11
|
180
181
|
universal-java-18
|
@@ -203,4 +204,4 @@ DEPENDENCIES
|
|
203
204
|
yard
|
204
205
|
|
205
206
|
BUNDLED WITH
|
206
|
-
2.
|
207
|
+
2.5.3
|
data/lib/ruby_units/unit.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'date'
|
2
2
|
module RubyUnits
|
3
|
-
# Copyright 2006-
|
3
|
+
# Copyright 2006-2024
|
4
4
|
# @author Kevin C. Olbrich, Ph.D.
|
5
5
|
# @see https://github.com/olbrich/ruby-units
|
6
6
|
#
|
@@ -165,6 +165,17 @@ module RubyUnits
|
|
165
165
|
|
166
166
|
# Class Methods
|
167
167
|
|
168
|
+
# Callback triggered when a subclass is created. This properly sets up the internal variables, and copies
|
169
|
+
# definitions from the parent class.
|
170
|
+
#
|
171
|
+
# @param [Class] subclass
|
172
|
+
def self.inherited(subclass)
|
173
|
+
super
|
174
|
+
subclass.definitions = definitions.dup
|
175
|
+
subclass.instance_variable_set(:@kinds, @kinds.dup)
|
176
|
+
subclass.setup
|
177
|
+
end
|
178
|
+
|
168
179
|
# setup internal arrays and hashes
|
169
180
|
# @return [Boolean]
|
170
181
|
def self.setup
|
@@ -1629,8 +1640,11 @@ module RubyUnits
|
|
1629
1640
|
return self
|
1630
1641
|
end
|
1631
1642
|
|
1632
|
-
while unit_string.gsub!(
|
1633
|
-
#
|
1643
|
+
while unit_string.gsub!(/<(#{self.class.prefix_regex})><(#{self.class.unit_regex})>/, '<\1\2>')
|
1644
|
+
# replace <prefix><unit> with <prefixunit>
|
1645
|
+
end
|
1646
|
+
while unit_string.gsub!(/<#{self.class.unit_match_regex}><#{self.class.unit_match_regex}>/, '<\1\2>*<\3\4>')
|
1647
|
+
# collapse <prefixunit><prefixunit> into <prefixunit>*<prefixunit>...
|
1634
1648
|
end
|
1635
1649
|
# ... and then strip the remaining brackets for x*y*z
|
1636
1650
|
unit_string.gsub!(/[<>]/, '')
|
@@ -27,7 +27,8 @@ end
|
|
27
27
|
|
28
28
|
RubyUnits::Unit.define('naut-mile') do |naut|
|
29
29
|
naut.definition = RubyUnits::Unit.new('1852 m')
|
30
|
-
naut.aliases = %w[nmi
|
30
|
+
naut.aliases = %w[nmi NM]
|
31
|
+
# Don't use the 'M' abbreviation here since it conflicts with 'Molar'
|
31
32
|
end
|
32
33
|
|
33
34
|
# on land
|
@@ -71,7 +72,9 @@ end
|
|
71
72
|
|
72
73
|
RubyUnits::Unit.define('pica') do |pica|
|
73
74
|
pica.definition = RubyUnits::Unit.new('1/72 ft')
|
74
|
-
pica.aliases = %w[
|
75
|
+
pica.aliases = %w[pica picas]
|
76
|
+
# Don't use 'P' as an abbreviation since it conflicts with 'Poise'
|
77
|
+
# Don't use 'pc' as an abbreviation since it conflicts with 'parsec'
|
75
78
|
end
|
76
79
|
|
77
80
|
RubyUnits::Unit.define('point') do |point|
|
data/lib/ruby_units/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-units
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Olbrich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '2.0'
|
108
108
|
requirements: []
|
109
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.2.33
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Provides classes and methods to perform unit math and conversions
|