weighable 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +19 -0
- data/.gitignore +1 -1
- data/.ruby-version +1 -1
- data/Gemfile-rails4 +6 -0
- data/{Gemfile → Gemfile-rails5} +2 -0
- data/Gemfile-rails6 +6 -0
- data/README.md +1 -1
- data/lib/weighable/version.rb +1 -1
- data/lib/weighable/weight.rb +7 -7
- data/weighable.gemspec +2 -2
- metadata +16 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 31c05d666a97b448105e5a074c65a5f3f55a174f9e594f04567d36abf07ec3b2
|
4
|
+
data.tar.gz: eecfc7259d196bc8480bec0a8a65960359ccbfd2a5a1bec6491f421890f46706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47017d565bce95f6b597459155d83d7d4b5ba372e3e94c1aa89a3581706ec1a98cd0f746b04154bd97d23a369453d25c7de51278562948ebee7f6d2bb61d5a79
|
7
|
+
data.tar.gz: 0a9238a5c9ca54d15a4cd3d766dc27285faea5d8d1a42e1584e33a239326086ba03a8e613a464526bf007b004ddacac12aa0a036c47f2e5def83d77709c01198
|
@@ -0,0 +1,19 @@
|
|
1
|
+
on: push
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
build:
|
5
|
+
runs-on: ubuntu-16.04
|
6
|
+
strategy:
|
7
|
+
matrix:
|
8
|
+
ruby: [ '2.5', '2.6', '2.7' ]
|
9
|
+
rails: [ 4, 5, 6 ]
|
10
|
+
name: weighable ruby:${{matrix.ruby}} rails:${{matrix.rails}}
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- uses: actions/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: ${{ matrix.ruby }}
|
16
|
+
- run: |
|
17
|
+
gem install bundler
|
18
|
+
bundle install --jobs 4 --retry 3 --gemfile=Gemfile-rails${{ matrix.rails }}
|
19
|
+
bundle exec rspec
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.0
|
data/Gemfile-rails4
ADDED
data/{Gemfile → Gemfile-rails5}
RENAMED
data/Gemfile-rails6
ADDED
data/README.md
CHANGED
@@ -83,7 +83,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
83
83
|
|
84
84
|
## Contributing
|
85
85
|
|
86
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
86
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/trobrock/weighable.
|
87
87
|
|
88
88
|
## License
|
89
89
|
|
data/lib/weighable/version.rb
CHANGED
data/lib/weighable/weight.rb
CHANGED
@@ -38,12 +38,12 @@ module Weighable
|
|
38
38
|
nil => :unit
|
39
39
|
}.freeze
|
40
40
|
|
41
|
-
GRAMS_PER_OUNCE = BigDecimal
|
42
|
-
GRAMS_PER_POUND = BigDecimal
|
43
|
-
OUNCES_PER_POUND = BigDecimal
|
44
|
-
MILLIGRAMS_PER_GRAM = BigDecimal
|
45
|
-
KILOGRAMS_PER_GRAM = BigDecimal
|
46
|
-
IDENTITY = BigDecimal
|
41
|
+
GRAMS_PER_OUNCE = BigDecimal('28.34952')
|
42
|
+
GRAMS_PER_POUND = BigDecimal('453.59237')
|
43
|
+
OUNCES_PER_POUND = BigDecimal('16')
|
44
|
+
MILLIGRAMS_PER_GRAM = BigDecimal('1000')
|
45
|
+
KILOGRAMS_PER_GRAM = BigDecimal('0.001')
|
46
|
+
IDENTITY = BigDecimal('1')
|
47
47
|
|
48
48
|
MILLIGRAMS_PER_OUNCE = GRAMS_PER_OUNCE * MILLIGRAMS_PER_GRAM
|
49
49
|
KILOGRAMS_PER_OUNCE = GRAMS_PER_OUNCE * KILOGRAMS_PER_GRAM
|
@@ -184,7 +184,7 @@ module Weighable
|
|
184
184
|
Weight.new(@value / to_math_value(other), unit_name)
|
185
185
|
else
|
186
186
|
other = other.to(unit_name)
|
187
|
-
BigDecimal
|
187
|
+
BigDecimal(@value / other.value)
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
data/weighable.gemspec
CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency 'activesupport'
|
23
|
+
spec.add_dependency 'activesupport'
|
24
24
|
|
25
|
-
spec.add_development_dependency 'bundler', '~> 1
|
25
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
26
26
|
spec.add_development_dependency 'rake', '~> 10.0'
|
27
27
|
spec.add_development_dependency 'rubocop', '~> 0.49.0'
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weighable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trae Robrock
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
33
|
+
version: '2.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,13 +144,16 @@ extensions: []
|
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
146
|
- ".circleci/config.yml"
|
147
|
+
- ".github/workflows/ci.yml"
|
147
148
|
- ".gitignore"
|
148
149
|
- ".hound.yml"
|
149
150
|
- ".rspec"
|
150
151
|
- ".rubocop.yml"
|
151
152
|
- ".ruby-style.yml"
|
152
153
|
- ".ruby-version"
|
153
|
-
- Gemfile
|
154
|
+
- Gemfile-rails4
|
155
|
+
- Gemfile-rails5
|
156
|
+
- Gemfile-rails6
|
154
157
|
- Guardfile
|
155
158
|
- LICENSE.txt
|
156
159
|
- README.md
|
@@ -173,7 +176,7 @@ homepage: https://github.com/greenbits/weighable
|
|
173
176
|
licenses:
|
174
177
|
- MIT
|
175
178
|
metadata: {}
|
176
|
-
post_install_message:
|
179
|
+
post_install_message:
|
177
180
|
rdoc_options: []
|
178
181
|
require_paths:
|
179
182
|
- lib
|
@@ -188,9 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
191
|
- !ruby/object:Gem::Version
|
189
192
|
version: '0'
|
190
193
|
requirements: []
|
191
|
-
|
192
|
-
|
193
|
-
signing_key:
|
194
|
+
rubygems_version: 3.1.2
|
195
|
+
signing_key:
|
194
196
|
specification_version: 4
|
195
197
|
summary: Like BigDecimal, but for weight. Includes Rails integration.
|
196
198
|
test_files: []
|