unitwise 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/ruby.yml +42 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile +2 -2
- data/README.md +3 -6
- data/lib/unitwise/atom.rb +7 -1
- data/lib/unitwise/number.rb +1 -1
- data/lib/unitwise/prefix.rb +2 -1
- data/lib/unitwise/version.rb +1 -1
- data/test/test_helper.rb +1 -5
- data/test/unitwise/number_test.rb +5 -5
- data/unitwise.gemspec +6 -6
- metadata +20 -20
- data/.travis.yml +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0b30819c084e209df80a01852db2ab40a8e915af15321de9cd8e7181a4a7f622
|
4
|
+
data.tar.gz: 259f79ef2e7578d279f1c82adf861bc33166668fa39d20c2b5f906bd1b6fbfcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58310aa10271d1f864418bfb50641b102fa3227be68016ee97321c5f12054a48b4e8c76af02447b3dbe49f60aa5013d87c61b8fb7d17c67330d4c319b58fb1e7
|
7
|
+
data.tar.gz: 5422e3694fa60e13004221a3c5e75fdc633cc29b47142959e11712c0813f0112c86b6b59c6cf9828baaefc6bcafded450099d5929fa9b02f3da6a1df18768f58
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on: [push, pull_request]
|
11
|
+
|
12
|
+
permissions:
|
13
|
+
contents: read
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
test:
|
17
|
+
strategy:
|
18
|
+
fail-fast: false
|
19
|
+
matrix:
|
20
|
+
ruby-version:
|
21
|
+
- '2.6'
|
22
|
+
- '2.7'
|
23
|
+
- '3.0'
|
24
|
+
- '3.1'
|
25
|
+
- 'jruby'
|
26
|
+
- 'truffleruby'
|
27
|
+
|
28
|
+
name: ${{ format('Tests (Ruby {0})', matrix.ruby-version) }}
|
29
|
+
runs-on: ubuntu-latest
|
30
|
+
env:
|
31
|
+
BUNDLE_WITHOUT: 'yard pry'
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v3
|
34
|
+
|
35
|
+
- name: Set up Ruby
|
36
|
+
uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
ruby-version: ${{ matrix.ruby-version }}
|
39
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
40
|
+
|
41
|
+
- name: Run tests
|
42
|
+
run: bundle exec rake
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.1
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,13 @@ Unitwise uses semantic versioning.
|
|
7
7
|
|
8
8
|
## Unreleased
|
9
9
|
|
10
|
+
## 2.3.0 - 2022-10-19
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Support for newer Rubies (2.6+) & drops support for older ones (2.6 is EOL but will continue to support for now)
|
15
|
+
- Support for Psych 4. Note: unit data YAML files in the gem are loaded using `unsafe_load`
|
16
|
+
|
10
17
|
## 2.2.0 - 2017-07-14
|
11
18
|
|
12
19
|
### Fixed
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
# [Unitwise](//github.com/joshwlewis/unitwise)
|
2
2
|
|
3
3
|
[![Gem Version](http://img.shields.io/gem/v/unitwise.svg?style=flat)](https://rubygems.org/gems/unitwise)
|
4
|
-
[![Build Status](
|
5
|
-
[![Dependency Status](http://img.shields.io/gemnasium/joshwlewis/unitwise.svg?style=flat)](https://gemnasium.com/joshwlewis/unitwise)
|
4
|
+
[![Build Status](https://github.com/joshwlewis/unitwise/actions/workflows/ruby.yml/badge.svg)](https://github.com/joshwlewis/unitwise/actions/workflows/ruby.yml)
|
6
5
|
[![Coverage Status](http://img.shields.io/coveralls/joshwlewis/unitwise.svg?style=flat)](https://coveralls.io/r/joshwlewis/unitwise)
|
7
6
|
[![Code Climate](http://img.shields.io/codeclimate/github/joshwlewis/unitwise.svg?style=flat)](https://codeclimate.com/github/joshwlewis/unitwise)
|
8
|
-
![Analytics](https://ga-beacon.appspot.com/UA-49481499-1/joshwlewis/unitwise?pixel)
|
9
7
|
|
10
8
|
Unitwise is a Ruby library for unit measurement conversion and math.
|
11
9
|
|
@@ -273,10 +271,9 @@ Unitwise(1, "🥃").to_cup
|
|
273
271
|
This library aims to support and is tested against the following Ruby
|
274
272
|
implementations:
|
275
273
|
|
276
|
-
* Ruby 2.
|
277
|
-
* Ruby 2.3
|
278
|
-
* Ruby 2.4
|
274
|
+
* Ruby 2.6 - 3.1
|
279
275
|
* [JRuby](http://jruby.org/)
|
276
|
+
* [TruffleRuby](https://github.com/oracle/truffleruby)
|
280
277
|
|
281
278
|
If something doesn't work on one of these versions, it's a bug.
|
282
279
|
|
data/lib/unitwise/atom.rb
CHANGED
@@ -10,7 +10,13 @@ module Unitwise
|
|
10
10
|
# Array of hashes representing default atom properties.
|
11
11
|
# @api private
|
12
12
|
def data
|
13
|
-
@data ||=
|
13
|
+
@data ||= begin
|
14
|
+
properties = data_files.map do |file|
|
15
|
+
f = File.open(file)
|
16
|
+
::YAML.respond_to?(:unsafe_load) ? ::YAML.unsafe_load(f) : ::YAML.load(f)
|
17
|
+
end
|
18
|
+
properties.flatten
|
19
|
+
end
|
14
20
|
end
|
15
21
|
|
16
22
|
# Data files containing default atom data
|
data/lib/unitwise/number.rb
CHANGED
data/lib/unitwise/prefix.rb
CHANGED
@@ -6,7 +6,8 @@ module Unitwise
|
|
6
6
|
# The data loaded from the UCUM spec files
|
7
7
|
# @api semipublic
|
8
8
|
def self.data
|
9
|
-
|
9
|
+
f = File.open(data_file)
|
10
|
+
@data ||= ::YAML.respond_to?(:unsafe_load) ? ::YAML.unsafe_load(f) : ::YAML.load(f)
|
10
11
|
end
|
11
12
|
|
12
13
|
# The location of the UCUM spec prefix data file
|
data/lib/unitwise/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -3,20 +3,20 @@ require 'test_helper'
|
|
3
3
|
describe Unitwise::Number do
|
4
4
|
describe ".simplify" do
|
5
5
|
it "simplifies to an Integer" do
|
6
|
-
[2, 2.0, BigDecimal
|
6
|
+
[2, 2.0, BigDecimal(2), Rational(2, 1), '2', '2.0'].each do |n|
|
7
7
|
assert_equal Unitwise::Number.simplify(n), 2
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
it "simplifies to a Float" do
|
12
|
-
[2.25, BigDecimal
|
12
|
+
[2.25, BigDecimal('2.25'), Rational(9, 4), '2.25'].each do |n|
|
13
13
|
assert_equal Unitwise::Number.simplify(n), 2.25
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
it "doesn't simplify complex BigDecimals" do
|
18
18
|
s = "1234567890.0123456789"
|
19
|
-
d = BigDecimal
|
19
|
+
d = BigDecimal(s)
|
20
20
|
[s, d].each do |n|
|
21
21
|
assert_equal Unitwise::Number.simplify(n), d
|
22
22
|
end
|
@@ -37,14 +37,14 @@ describe Unitwise::Number do
|
|
37
37
|
|
38
38
|
it "converts decimal values to BigDecimals" do
|
39
39
|
[1.5, "1.5", "1.50", "0.15e1"].each do |n|
|
40
|
-
assert Unitwise::Number.coefficify(n).eql?(BigDecimal
|
40
|
+
assert Unitwise::Number.coefficify(n).eql?(BigDecimal("1.5"))
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe ".rationalize" do
|
46
46
|
it "coerces numbers to rationals" do
|
47
|
-
[1.5, "1.5", BigDecimal
|
47
|
+
[1.5, "1.5", BigDecimal("1.5")].each do |n|
|
48
48
|
assert_equal Unitwise::Number.rationalize(n), Rational(3, 2)
|
49
49
|
end
|
50
50
|
end
|
data/unitwise.gemspec
CHANGED
@@ -23,11 +23,11 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_dependency 'liner', '~> 0.2'
|
24
24
|
gem.add_dependency 'signed_multiset', '~> 0.2'
|
25
25
|
gem.add_dependency 'memoizable', '~> 0.4'
|
26
|
-
gem.add_dependency 'parslet', '~>
|
26
|
+
gem.add_dependency 'parslet', '~> 2.0'
|
27
27
|
|
28
|
-
gem.add_development_dependency 'nokogiri', '~> 1.
|
29
|
-
gem.add_development_dependency 'pry', '~> 0.
|
30
|
-
gem.add_development_dependency 'minitest', '~> 5.
|
31
|
-
gem.add_development_dependency 'rake', '~>
|
32
|
-
gem.add_development_dependency 'nori', '~> 2.
|
28
|
+
gem.add_development_dependency 'nokogiri', '~> 1.13'
|
29
|
+
gem.add_development_dependency 'pry', '~> 0.14'
|
30
|
+
gem.add_development_dependency 'minitest', '~> 5.15'
|
31
|
+
gem.add_development_dependency 'rake', '~> 13.0'
|
32
|
+
gem.add_development_dependency 'nori', '~> 2.6'
|
33
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unitwise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Lewis
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: liner
|
@@ -58,84 +58,84 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: nokogiri
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
75
|
+
version: '1.13'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
82
|
+
version: '1.13'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
89
|
+
version: '0.14'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
96
|
+
version: '0.14'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: minitest
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '5.
|
103
|
+
version: '5.15'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '5.
|
110
|
+
version: '5.15'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '13.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '13.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: nori
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '2.
|
131
|
+
version: '2.6'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '2.
|
138
|
+
version: '2.6'
|
139
139
|
description: Physical quantity and units of measure conversion and math library
|
140
140
|
email:
|
141
141
|
- josh.w.lewis@gmail.com
|
@@ -143,9 +143,10 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
+
- ".github/dependabot.yml"
|
147
|
+
- ".github/workflows/ruby.yml"
|
146
148
|
- ".gitignore"
|
147
149
|
- ".ruby-version"
|
148
|
-
- ".travis.yml"
|
149
150
|
- CHANGELOG.md
|
150
151
|
- Gemfile
|
151
152
|
- LICENSE.txt
|
@@ -203,7 +204,7 @@ homepage: http://github.com/joshwlewis/unitwise
|
|
203
204
|
licenses:
|
204
205
|
- MIT
|
205
206
|
metadata: {}
|
206
|
-
post_install_message:
|
207
|
+
post_install_message:
|
207
208
|
rdoc_options: []
|
208
209
|
require_paths:
|
209
210
|
- lib
|
@@ -218,9 +219,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
219
|
- !ruby/object:Gem::Version
|
219
220
|
version: '0'
|
220
221
|
requirements: []
|
221
|
-
|
222
|
-
|
223
|
-
signing_key:
|
222
|
+
rubygems_version: 3.3.7
|
223
|
+
signing_key:
|
224
224
|
specification_version: 4
|
225
225
|
summary: Convert between and perform mathematical operations on physical quantities
|
226
226
|
and units of measure defined by the Unified Code for Units of Measure.
|
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
bundler_args: --without yard pry
|
4
|
-
sudo: false
|
5
|
-
rvm:
|
6
|
-
- 2.2.7
|
7
|
-
- 2.3.4
|
8
|
-
- 2.4.1
|
9
|
-
- jruby-9.1.8.0
|
10
|
-
- ruby-head
|
11
|
-
- jruby-head
|
12
|
-
matrix:
|
13
|
-
allow_failures:
|
14
|
-
- rvm: ruby-head
|
15
|
-
- rvm: jruby-head
|
16
|
-
fast_finish: true
|