ruby-units 2.3.2 → 2.4.1

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: fb1ccadd6b955b26c4853ecba154e78c4313ef1baa953d9bac365aeccf152912
4
- data.tar.gz: 6c88b7f180d6b30f216dca3a6e990d2a5a4406dd515cc3e756d9f3cb5a5df2c6
3
+ metadata.gz: cef2eee9d07cdfbb9761babe05cf20dcd2d64fcd8b1c72e1c82f0c7120f0aafe
4
+ data.tar.gz: 3b7f5ecd1dff12af14de4f9c6eb5109a7a09f0fa3223f5880befbb99a556237b
5
5
  SHA512:
6
- metadata.gz: 060c9895cc09a6a0de5f6e3a4c28e9c780f8a7b81ac1f73e8e5601f895edb00a6289cfacac4822d6d4bdb6f933985192e8791edb1a33f858b33d0ad75d1f55e4
7
- data.tar.gz: 51b19481a8fbb8fce5a4f37c20ecffb2f5869853f261908a95339ff1b8c8504f2183ab48d26a0981f0e87e63f7c5eac104234eaa5086eb92fb84ca49e38bfa08
6
+ metadata.gz: 44f63528e99535c8d5dd56ce7a2ca4f2a1fe800ace101495be272c5fa9e6c25b6abd3d1f35c695cf69ec848b333c8b9147f044e275122124bf08b1acee432bcb
7
+ data.tar.gz: cb72ea094586f7750524527c605f151431b0c96d3d3350337eceed2f7fb29d30568f14f0c2f9ee2179b0f8ca638b1cfef580c8929c2551ff9085107bd6d7cd8f
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "10:00"
8
+ open-pull-requests-limit: 10
9
+ ignore:
10
+ - dependency-name: solargraph
11
+ versions:
12
+ - 0.40.2
13
+ - 0.40.3
14
+ - dependency-name: nokogiri
15
+ versions:
16
+ - 1.11.1
@@ -0,0 +1,70 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ master ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ master ]
20
+ schedule:
21
+ - cron: '15 17 * * 6'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v2
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v1
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
52
+
53
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
+ # If this step fails, then you should remove it and run the build manually (see below)
55
+ - name: Autobuild
56
+ uses: github/codeql-action/autobuild@v1
57
+
58
+ # ℹ️ Command-line programs to run using the OS shell.
59
+ # 📚 https://git.io/JvXDl
60
+
61
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62
+ # and modify them (or add more) to build your code if your project
63
+ # uses a compiled language
64
+
65
+ #- run: |
66
+ # make bootstrap
67
+ # make release
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v1
@@ -15,7 +15,7 @@ jobs:
15
15
  strategy:
16
16
  fail-fast: false
17
17
  matrix:
18
- ruby: ['2.5', '2.6', '2.7', '3.0', 'jruby-9.2']
18
+ ruby: ['2.6', '2.7', '3.0', '3.1', 'jruby-9.3']
19
19
  steps:
20
20
  - uses: actions/checkout@v2
21
21
  - uses: ruby/setup-ruby@v1
@@ -38,3 +38,12 @@ jobs:
38
38
  CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
39
39
  with:
40
40
  coverageCommand: bundle exec rake
41
+ yard:
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - uses: actions/checkout@v2
45
+ - uses: ruby/setup-ruby@v1
46
+ with:
47
+ bundler-cache: true
48
+ - name: Build YARD docs
49
+ run: bundle exec yard doc --fail-on-warning
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.8
1
+ 2.6.10
data/CHANGELOG.txt CHANGED
@@ -1,5 +1,7 @@
1
1
  Change Log for Ruby-units
2
2
  =========================
3
+ see Github releases (https://github.com/olbrich/ruby-units/releases)
4
+
3
5
  2020-12-29 2.3.2 * Remove Jeweler (see #178) also adds Code of Conduct
4
6
  * Fix specs related to Complex comparisons (see #213)
5
7
  * Add support for Ruby 3.0 (also drop support for 2.3 and 2.4) (see #211)
data/Gemfile CHANGED
@@ -1,7 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  group :development do
4
- gem 'pry-byebug', platform: :mri
4
+ gem 'debug', '>= 1.0.0', platform: :mri
5
+ gem 'redcarpet', platform: :mri # redcarpet doesn't support jruby
5
6
  gem 'ruby-maven', platform: :jruby
6
7
  gem 'ruby-prof', platform: :mri
7
8
  end
data/Gemfile.lock CHANGED
@@ -1,29 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-units (2.3.2)
4
+ ruby-units (2.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.1)
10
- backport (1.1.2)
11
- benchmark (0.1.1)
12
- byebug (11.1.3)
9
+ ast (2.4.2)
10
+ backport (1.2.0)
11
+ benchmark (0.2.0)
13
12
  coderay (1.1.3)
14
- diff-lcs (1.4.4)
15
- docile (1.3.4)
13
+ debug (1.6.2)
14
+ irb (>= 1.3.6)
15
+ reline (>= 0.3.1)
16
+ diff-lcs (1.5.0)
17
+ docile (1.4.0)
16
18
  e2mmap (0.1.0)
17
- ffi (1.14.2)
18
- ffi (1.14.2-java)
19
- formatador (0.2.5)
20
- guard (2.16.2)
19
+ ffi (1.15.5)
20
+ ffi (1.15.5-java)
21
+ formatador (1.1.0)
22
+ guard (2.18.0)
21
23
  formatador (>= 0.2.4)
22
24
  listen (>= 2.7, < 4.0)
23
25
  lumberjack (>= 1.0.12, < 2.0)
24
26
  nenv (~> 0.1)
25
27
  notiffany (~> 0.0)
26
- pry (>= 0.9.12)
28
+ pry (>= 0.13.0)
27
29
  shellany (~> 0.0)
28
30
  thor (>= 0.18.1)
29
31
  guard-compat (1.2.1)
@@ -31,97 +33,109 @@ GEM
31
33
  guard (~> 2.1)
32
34
  guard-compat (~> 1.1)
33
35
  rspec (>= 2.99.0, < 4.0)
36
+ io-console (0.5.11)
37
+ irb (1.4.1)
38
+ reline (>= 0.3.0)
34
39
  jaro_winkler (1.5.4)
35
40
  jaro_winkler (1.5.4-java)
36
- kramdown (2.3.0)
41
+ json (2.6.2)
42
+ json (2.6.2-java)
43
+ kramdown (2.4.0)
37
44
  rexml
38
45
  kramdown-parser-gfm (1.1.0)
39
46
  kramdown (~> 2.0)
40
- listen (3.3.3)
47
+ listen (3.7.1)
41
48
  rb-fsevent (~> 0.10, >= 0.10.3)
42
49
  rb-inotify (~> 0.9, >= 0.9.10)
43
50
  lumberjack (1.2.8)
44
51
  method_source (1.0.0)
45
- mini_portile2 (2.4.0)
52
+ mini_portile2 (2.8.0)
46
53
  nenv (0.3.0)
47
- nokogiri (1.10.10)
48
- mini_portile2 (~> 2.4.0)
49
- nokogiri (1.10.10-java)
54
+ nokogiri (1.13.8)
55
+ mini_portile2 (~> 2.8.0)
56
+ racc (~> 1.4)
57
+ nokogiri (1.13.8-java)
58
+ racc (~> 1.4)
59
+ nokogiri (1.13.8-x86_64-darwin)
60
+ racc (~> 1.4)
50
61
  notiffany (0.1.3)
51
62
  nenv (~> 0.1)
52
63
  shellany (~> 0.0)
53
- parallel (1.20.1)
54
- parser (2.7.2.0)
64
+ parallel (1.22.1)
65
+ parser (3.1.2.1)
55
66
  ast (~> 2.4.1)
56
- pry (0.13.1)
67
+ pry (0.14.1)
57
68
  coderay (~> 1.1)
58
69
  method_source (~> 1.0)
59
- pry (0.13.1-java)
70
+ pry (0.14.1-java)
60
71
  coderay (~> 1.1)
61
72
  method_source (~> 1.0)
62
73
  spoon (~> 0.0)
63
- pry-byebug (3.9.0)
64
- byebug (~> 11.0)
65
- pry (~> 0.13.0)
66
- rainbow (3.0.0)
67
- rake (13.0.3)
68
- rb-fsevent (0.10.4)
74
+ racc (1.6.0)
75
+ racc (1.6.0-java)
76
+ rainbow (3.1.1)
77
+ rake (13.0.6)
78
+ rb-fsevent (0.11.1)
69
79
  rb-inotify (0.10.1)
70
80
  ffi (~> 1.0)
71
- regexp_parser (2.0.3)
72
- reverse_markdown (2.0.0)
81
+ redcarpet (3.5.1)
82
+ regexp_parser (2.5.0)
83
+ reline (0.3.1)
84
+ io-console (~> 0.5)
85
+ reverse_markdown (2.1.1)
73
86
  nokogiri
74
- rexml (3.2.4)
75
- rspec (3.10.0)
76
- rspec-core (~> 3.10.0)
77
- rspec-expectations (~> 3.10.0)
78
- rspec-mocks (~> 3.10.0)
79
- rspec-core (3.10.1)
80
- rspec-support (~> 3.10.0)
81
- rspec-expectations (3.10.1)
87
+ rexml (3.2.5)
88
+ rspec (3.11.0)
89
+ rspec-core (~> 3.11.0)
90
+ rspec-expectations (~> 3.11.0)
91
+ rspec-mocks (~> 3.11.0)
92
+ rspec-core (3.11.0)
93
+ rspec-support (~> 3.11.0)
94
+ rspec-expectations (3.11.0)
82
95
  diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.10.0)
84
- rspec-mocks (3.10.1)
96
+ rspec-support (~> 3.11.0)
97
+ rspec-mocks (3.11.1)
85
98
  diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.10.0)
87
- rspec-support (3.10.1)
88
- rubocop (1.7.0)
99
+ rspec-support (~> 3.11.0)
100
+ rspec-support (3.11.0)
101
+ rubocop (1.35.1)
102
+ json (~> 2.3)
89
103
  parallel (~> 1.10)
90
- parser (>= 2.7.1.5)
104
+ parser (>= 3.1.2.1)
91
105
  rainbow (>= 2.2.2, < 4.0)
92
106
  regexp_parser (>= 1.8, < 3.0)
93
- rexml
94
- rubocop-ast (>= 1.2.0, < 2.0)
107
+ rexml (>= 3.2.5, < 4.0)
108
+ rubocop-ast (>= 1.20.1, < 2.0)
95
109
  ruby-progressbar (~> 1.7)
96
- unicode-display_width (>= 1.4.0, < 2.0)
97
- rubocop-ast (1.3.0)
98
- parser (>= 2.7.1.5)
99
- rubocop-rake (0.5.1)
100
- rubocop
101
- rubocop-rspec (2.1.0)
110
+ unicode-display_width (>= 1.4.0, < 3.0)
111
+ rubocop-ast (1.21.0)
112
+ parser (>= 3.1.1.0)
113
+ rubocop-rake (0.6.0)
102
114
  rubocop (~> 1.0)
103
- rubocop-ast (>= 1.1.0)
104
- ruby-maven (3.3.12)
115
+ rubocop-rspec (2.12.1)
116
+ rubocop (~> 1.31)
117
+ ruby-maven (3.3.13)
105
118
  ruby-maven-libs (~> 3.3.9)
106
119
  ruby-maven-libs (3.3.9)
107
- ruby-prof (1.4.2)
108
- ruby-progressbar (1.10.1)
120
+ ruby-prof (1.4.3)
121
+ ruby-progressbar (1.11.0)
109
122
  shellany (0.0.1)
110
- simplecov (0.20.0)
123
+ simplecov (0.21.2)
111
124
  docile (~> 1.1)
112
125
  simplecov-html (~> 0.11)
113
126
  simplecov_json_formatter (~> 0.1)
114
127
  simplecov-html (0.12.3)
115
- simplecov_json_formatter (0.1.2)
116
- solargraph (0.40.1)
117
- backport (~> 1.1)
128
+ simplecov_json_formatter (0.1.4)
129
+ solargraph (0.46.0)
130
+ backport (~> 1.2)
118
131
  benchmark
119
132
  bundler (>= 1.17.2)
133
+ diff-lcs (~> 1.4)
120
134
  e2mmap
121
135
  jaro_winkler (~> 1.5)
122
136
  kramdown (~> 2.3)
123
137
  kramdown-parser-gfm (~> 1.1)
124
- parser (~> 2.3)
138
+ parser (~> 3.0)
125
139
  reverse_markdown (>= 1.0.5, < 3)
126
140
  rubocop (>= 0.52)
127
141
  thor (~> 1.0)
@@ -131,10 +145,12 @@ GEM
131
145
  ffi
132
146
  terminal-notifier (2.0.0)
133
147
  terminal-notifier-guard (1.7.0)
134
- thor (1.0.1)
135
- tilt (2.0.10)
136
- unicode-display_width (1.7.0)
137
- yard (0.9.26)
148
+ thor (1.2.1)
149
+ tilt (2.0.11)
150
+ unicode-display_width (2.2.0)
151
+ webrick (1.7.0)
152
+ yard (0.9.28)
153
+ webrick (~> 1.7.0)
138
154
 
139
155
  PLATFORMS
140
156
  java
@@ -143,10 +159,11 @@ PLATFORMS
143
159
  x86_64-darwin-19
144
160
 
145
161
  DEPENDENCIES
162
+ debug (>= 1.0.0)
146
163
  guard-rspec
147
164
  pry
148
- pry-byebug
149
165
  rake
166
+ redcarpet
150
167
  rspec (~> 3.0)
151
168
  rubocop
152
169
  rubocop-rake
@@ -159,6 +176,8 @@ DEPENDENCIES
159
176
  solargraph
160
177
  terminal-notifier
161
178
  terminal-notifier-guard
179
+ webrick
180
+ yard
162
181
 
163
182
  BUNDLED WITH
164
- 2.2.3
183
+ 2.3.13
data/lib/ruby-units.rb CHANGED
@@ -1,3 +1,2 @@
1
- $LOAD_PATH << File.dirname(__FILE__)
2
1
  require_relative 'ruby_units/namespaced'
3
2
  Unit = RubyUnits::Unit
@@ -24,9 +24,9 @@ module RubyUnits
24
24
 
25
25
  # holds actual configuration values for RubyUnits
26
26
  class Configuration
27
- # used to separate the scalar from the unit when generating output.
28
- # set to nil to prevent adding a space to the string representation of a unit
29
- # separators other than ' ' and '' may work, but you may encounter problems
27
+ # Used to separate the scalar from the unit when generating output. A value
28
+ # of `true` will insert a single space, and `false` will prevent adding a
29
+ # space to the string representation of a unit.
30
30
  attr_reader :separator
31
31
 
32
32
  def initialize
@@ -34,7 +34,8 @@ module RubyUnits
34
34
  end
35
35
 
36
36
  def separator=(value)
37
- raise ArgumentError, "configuration 'separator' may only be true or false" unless value.class == TrueClass || value.class == FalseClass
37
+ raise ArgumentError, "configuration 'separator' may only be true or false" unless value == true || value == false
38
+
38
39
  @separator = value ? ' ' : nil
39
40
  end
40
41
  end
@@ -16,6 +16,10 @@ class RubyUnits::Unit < Numeric
16
16
  # @return [Array]
17
17
  attr_accessor :denominator
18
18
 
19
+ # Unit name to be used when generating output. This MUST be a parseable
20
+ # string or it won't be possible to round trip the unit to a String and
21
+ # back.
22
+ #
19
23
  # @return [String]
20
24
  attr_accessor :display_name
21
25
 
@@ -48,7 +52,7 @@ class RubyUnits::Unit < Numeric
48
52
  end
49
53
 
50
54
  # set the name, strip off '<' and '>'
51
- # @param [String]
55
+ # @param name_value [String]
52
56
  # @return [String]
53
57
  def name=(name_value)
54
58
  @name = name_value.gsub(/[<>]/, '')
@@ -57,7 +61,7 @@ class RubyUnits::Unit < Numeric
57
61
  # alias array must contain the name of the unit and entries must be unique
58
62
  # @return [Array]
59
63
  def aliases
60
- [[@aliases], @name].flatten.compact.uniq
64
+ [[@aliases], @name, @display_name].flatten.compact.uniq
61
65
  end
62
66
 
63
67
  # define a unit in terms of another unit
@@ -1,6 +1,3 @@
1
-
2
- $LOAD_PATH << File.dirname(__FILE__)
3
-
4
1
  # require_relative this file to avoid creating an class alias from Unit to RubyUnits::Unit
5
2
  require_relative 'version'
6
3
  require_relative 'configuration'