lite-measurements 1.0.2 → 1.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: 9259cdb3e90321e0acf11ffdbc87deea1dd586e9cfb530de8250c94ae7751fa1
4
- data.tar.gz: fea4f5aab97984d830feecb62a2d0106d84d9222f11f5c2930ef7b68c1189723
3
+ metadata.gz: 3f6f4646a1219a062395af2f412d64f0fa50be8c167edd2e531a1ce2dd1b7af7
4
+ data.tar.gz: ceea97214e9dc5f91303f5e1ea0216374f334448d2fda98c550c591d3bf3160e
5
5
  SHA512:
6
- metadata.gz: 4bad2ee185da401aa15165fd9e7c43f09f70d6d72a3ee72e193ab6e6680eca48a0946a1ae0ef90908a3c8ba63ef68d0f2ffefd2451f839dc2e22d2107959fa92
7
- data.tar.gz: d70e6d4f2381c2389c54a052e2dc6efa98473eb5254d524d155e3d46e54563d4496e1a4f29ffc991cf16109ac954c0bdb7da3839ed06ad0d01f6cc5f5cbcaf49
6
+ metadata.gz: 3565377ae68b64638c8123eb60b2df3a2beed4627fb0a24c6c244f2ac11ec7b403ef3431f519098e96c9cfb3cf583f7d979166d9920ebf1860697326443c4153
7
+ data.tar.gz: e3a6bb3fc6bfff7dcd6c3b5398af6674e207305a7709d05bc53db085a7804a0c4de4f21edd508472de72ff62f9768481e6437bd79750ad5f820cc25de5b53de9
data/.rubocop.yml CHANGED
@@ -1,12 +1,16 @@
1
1
  require:
2
2
  - rubocop-performance
3
+ - rubocop-rake
3
4
  - rubocop-rspec
4
5
  AllCops:
5
- TargetRubyVersion: 2.6
6
+ TargetRubyVersion: 3.0
7
+ NewCops: enable
6
8
  DisplayCopNames: true
7
9
  DisplayStyleGuide: true
8
- LineLength:
9
- Max: 100
10
+ Gemspec/RequiredRubyVersion:
11
+ Enabled: false
12
+ Layout/EmptyLinesAroundAttributeAccessor:
13
+ Enabled: true
10
14
  Layout/EmptyLinesAroundBlockBody:
11
15
  Exclude:
12
16
  - 'spec/**/**/*'
@@ -14,10 +18,20 @@ Layout/EmptyLinesAroundClassBody:
14
18
  EnforcedStyle: empty_lines_except_namespace
15
19
  Layout/EmptyLinesAroundModuleBody:
16
20
  EnforcedStyle: empty_lines_except_namespace
21
+ Layout/LineLength:
22
+ Max: 100
23
+ Layout/SpaceAroundMethodCallOperator:
24
+ Enabled: true
25
+ Lint/RaiseException:
26
+ Enabled: true
27
+ Lint/StructNewOverride:
28
+ Enabled: true
17
29
  Metrics/BlockLength:
18
30
  Exclude:
19
31
  - 'spec/**/**/*'
20
32
  - '*.gemspec'
33
+ Style/ArgumentsForwarding:
34
+ Enabled: false
21
35
  Style/Documentation:
22
36
  Enabled: false
23
37
  Style/ExpandPathArguments:
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ cache: bundler
4
4
  rvm:
5
5
  - 2.5
6
6
  - 2.6
7
+ - 2.7
7
8
  - ruby-head
8
9
  matrix:
9
10
  fast_finish: true
data/CHANGELOG.md CHANGED
@@ -6,9 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.1.0] - 2021-07-19
10
+ ### Added
11
+ - Added Ruby 3.0 support
12
+
9
13
  ## [1.0.2] - 2019-08-24
14
+ ### Added
15
+ - Added ruby 2.7 support
10
16
  ### Changed
11
- - Imporved how configuration works
17
+ - Improved how configuration works
12
18
 
13
19
  ## [1.0.1] - 2019-08-17
14
20
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,107 +1,117 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-measurements (1.0.2)
4
+ lite-measurements (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionpack (6.0.0)
10
- actionview (= 6.0.0)
11
- activesupport (= 6.0.0)
12
- rack (~> 2.0)
9
+ actionpack (6.1.4)
10
+ actionview (= 6.1.4)
11
+ activesupport (= 6.1.4)
12
+ rack (~> 2.0, >= 2.0.9)
13
13
  rack-test (>= 0.6.3)
14
14
  rails-dom-testing (~> 2.0)
15
15
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
16
- actionview (6.0.0)
17
- activesupport (= 6.0.0)
16
+ actionview (6.1.4)
17
+ activesupport (= 6.1.4)
18
18
  builder (~> 3.1)
19
19
  erubi (~> 1.4)
20
20
  rails-dom-testing (~> 2.0)
21
21
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
22
- activesupport (6.0.0)
22
+ activesupport (6.1.4)
23
23
  concurrent-ruby (~> 1.0, >= 1.0.2)
24
- i18n (>= 0.7, < 2)
25
- minitest (~> 5.1)
26
- tzinfo (~> 1.1)
27
- zeitwerk (~> 2.1, >= 2.1.8)
28
- ast (2.4.0)
29
- builder (3.2.3)
24
+ i18n (>= 1.6, < 2)
25
+ minitest (>= 5.1)
26
+ tzinfo (~> 2.0)
27
+ zeitwerk (~> 2.3)
28
+ ast (2.4.2)
29
+ builder (3.2.4)
30
30
  colorize (0.8.1)
31
- concurrent-ruby (1.1.5)
32
- crass (1.0.4)
33
- diff-lcs (1.3)
34
- erubi (1.8.0)
35
- fasterer (0.6.0)
31
+ concurrent-ruby (1.1.9)
32
+ crass (1.0.6)
33
+ diff-lcs (1.4.4)
34
+ erubi (1.10.0)
35
+ fasterer (0.9.0)
36
36
  colorize (~> 0.7)
37
- ruby_parser (>= 3.13.0)
37
+ ruby_parser (>= 3.14.1)
38
38
  generator_spec (0.9.4)
39
39
  activesupport (>= 3.0.0)
40
40
  railties (>= 3.0.0)
41
- i18n (1.6.0)
41
+ i18n (1.8.10)
42
42
  concurrent-ruby (~> 1.0)
43
- jaro_winkler (1.5.3)
44
- loofah (2.2.3)
43
+ loofah (2.10.0)
45
44
  crass (~> 1.0.2)
46
45
  nokogiri (>= 1.5.9)
47
- method_source (0.9.2)
48
- mini_portile2 (2.4.0)
49
- minitest (5.11.3)
50
- nokogiri (1.10.4)
51
- mini_portile2 (~> 2.4.0)
52
- parallel (1.17.0)
53
- parser (2.6.3.0)
54
- ast (~> 2.4.0)
55
- rack (2.0.7)
46
+ method_source (1.0.0)
47
+ mini_portile2 (2.5.3)
48
+ minitest (5.14.4)
49
+ nokogiri (1.11.7)
50
+ mini_portile2 (~> 2.5.0)
51
+ racc (~> 1.4)
52
+ parallel (1.20.1)
53
+ parser (3.0.2.0)
54
+ ast (~> 2.4.1)
55
+ racc (1.5.2)
56
+ rack (2.2.3)
56
57
  rack-test (1.1.0)
57
58
  rack (>= 1.0, < 3)
58
59
  rails-dom-testing (2.0.3)
59
60
  activesupport (>= 4.2.0)
60
61
  nokogiri (>= 1.6)
61
- rails-html-sanitizer (1.2.0)
62
- loofah (~> 2.2, >= 2.2.2)
63
- railties (6.0.0)
64
- actionpack (= 6.0.0)
65
- activesupport (= 6.0.0)
62
+ rails-html-sanitizer (1.3.0)
63
+ loofah (~> 2.3)
64
+ railties (6.1.4)
65
+ actionpack (= 6.1.4)
66
+ activesupport (= 6.1.4)
66
67
  method_source
67
- rake (>= 0.8.7)
68
- thor (>= 0.20.3, < 2.0)
68
+ rake (>= 0.13)
69
+ thor (~> 1.0)
69
70
  rainbow (3.0.0)
70
- rake (12.3.3)
71
- rspec (3.8.0)
72
- rspec-core (~> 3.8.0)
73
- rspec-expectations (~> 3.8.0)
74
- rspec-mocks (~> 3.8.0)
75
- rspec-core (3.8.2)
76
- rspec-support (~> 3.8.0)
77
- rspec-expectations (3.8.4)
71
+ rake (13.0.6)
72
+ regexp_parser (2.1.1)
73
+ rexml (3.2.5)
74
+ rspec (3.10.0)
75
+ rspec-core (~> 3.10.0)
76
+ rspec-expectations (~> 3.10.0)
77
+ rspec-mocks (~> 3.10.0)
78
+ rspec-core (3.10.1)
79
+ rspec-support (~> 3.10.0)
80
+ rspec-expectations (3.10.1)
78
81
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.8.0)
80
- rspec-mocks (3.8.1)
82
+ rspec-support (~> 3.10.0)
83
+ rspec-mocks (3.10.2)
81
84
  diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.8.0)
83
- rspec-support (3.8.2)
84
- rubocop (0.74.0)
85
- jaro_winkler (~> 1.5.1)
85
+ rspec-support (~> 3.10.0)
86
+ rspec-support (3.10.2)
87
+ rubocop (1.18.3)
86
88
  parallel (~> 1.10)
87
- parser (>= 2.6)
89
+ parser (>= 3.0.0.0)
88
90
  rainbow (>= 2.2.2, < 4.0)
91
+ regexp_parser (>= 1.8, < 3.0)
92
+ rexml
93
+ rubocop-ast (>= 1.7.0, < 2.0)
89
94
  ruby-progressbar (~> 1.7)
90
- unicode-display_width (>= 1.4.0, < 1.7)
91
- rubocop-performance (1.4.1)
92
- rubocop (>= 0.71.0)
93
- rubocop-rspec (1.35.0)
94
- rubocop (>= 0.60.0)
95
- ruby-progressbar (1.10.1)
96
- ruby_parser (3.13.1)
97
- sexp_processor (~> 4.9)
98
- sexp_processor (4.12.1)
99
- thor (0.20.3)
100
- thread_safe (0.3.6)
101
- tzinfo (1.2.5)
102
- thread_safe (~> 0.1)
103
- unicode-display_width (1.6.0)
104
- zeitwerk (2.1.9)
95
+ unicode-display_width (>= 1.4.0, < 3.0)
96
+ rubocop-ast (1.8.0)
97
+ parser (>= 3.0.1.1)
98
+ rubocop-performance (1.11.4)
99
+ rubocop (>= 1.7.0, < 2.0)
100
+ rubocop-ast (>= 0.4.0)
101
+ rubocop-rake (0.6.0)
102
+ rubocop (~> 1.0)
103
+ rubocop-rspec (2.4.0)
104
+ rubocop (~> 1.0)
105
+ rubocop-ast (>= 1.1.0)
106
+ ruby-progressbar (1.11.0)
107
+ ruby_parser (3.16.0)
108
+ sexp_processor (~> 4.15, >= 4.15.1)
109
+ sexp_processor (4.15.3)
110
+ thor (1.1.0)
111
+ tzinfo (2.0.4)
112
+ concurrent-ruby (~> 1.0)
113
+ unicode-display_width (2.0.0)
114
+ zeitwerk (2.4.2)
105
115
 
106
116
  PLATFORMS
107
117
  ruby
@@ -115,7 +125,8 @@ DEPENDENCIES
115
125
  rspec
116
126
  rubocop
117
127
  rubocop-performance
128
+ rubocop-rake
118
129
  rubocop-rspec
119
130
 
120
131
  BUNDLED WITH
121
- 2.0.1
132
+ 2.2.24
@@ -6,7 +6,7 @@ module Lite
6
6
 
7
7
  include Lite::Measurements::Helpers::ShiftHelper
8
8
 
9
- DIGITAL_STORAGE_UNITS ||= {
9
+ DIGITAL_STORAGE_UNITS = {
10
10
  bytes: 1.0, kilobytes: 1024.0, megabytes: 1024.0**2, gigabytes: 1024.0**3,
11
11
  terabytes: 1024.0**4, petabytes: 1024.05**5, exabytes: 1024**6
12
12
  }.freeze
@@ -11,17 +11,17 @@ module Lite
11
11
  [imperical_keys, metric_keys].flatten
12
12
  end
13
13
 
14
- # rubocop:disable Metrics/LineLength
15
- def convert_to_imperical_units(units, from: nil, convert_to:, convert_from:, to: nil)
14
+ # rubocop:disable Layout/LineLength
15
+ def convert_to_imperical_units(units, convert_to:, convert_from:, from: nil, to: nil)
16
16
  units = shift_units(units, type: klass::METRIC_UNITS, from: from, to: convert_to)
17
17
  shift_units(units / klass::CONVERTER, type: klass::IMPERICAL_UNITS, from: convert_from, to: to)
18
18
  end
19
19
 
20
- def convert_to_metric_units(units, from: nil, convert_to:, convert_from:, to: nil)
20
+ def convert_to_metric_units(units, convert_to:, convert_from:, from: nil, to: nil)
21
21
  units = shift_units(units, type: klass::IMPERICAL_UNITS, from: from, to: convert_to)
22
22
  shift_units(units * klass::CONVERTER, type: klass::METRIC_UNITS, from: convert_from, to: to)
23
23
  end
24
- # rubocop:enable Metrics/LineLength
24
+ # rubocop:enable Layout/LineLength
25
25
 
26
26
  def convert_to_imperical_units?(from, to)
27
27
  metric_keys.include?(from) && imperical_keys.include?(to)
@@ -7,17 +7,17 @@ module Lite
7
7
  include Lite::Measurements::Helpers::ConversionHelper
8
8
  include Lite::Measurements::Helpers::ShiftHelper
9
9
 
10
- CONVERTER ||= 0.0254
10
+ CONVERTER = 0.0254
11
11
 
12
- IMPERICAL_UNITS ||= {
12
+ IMPERICAL_UNITS = {
13
13
  inches: 1.0, feet: 12.0, yards: 36.0, miles: 63_360.0, nautical_miles: 72_913.386
14
14
  }.freeze
15
- METRIC_UNITS ||= {
15
+ METRIC_UNITS = {
16
16
  micrometers: 0.000001, millimeters: 0.001, centimeters: 0.01, decimeters: 0.1, meters: 1.0,
17
17
  dekameters: 10.0, hectometers: 100.0, kilometers: 1_000.0
18
18
  }.freeze
19
19
 
20
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/LineLength
20
+ # rubocop:disable Metrics/MethodLength, Layout/LineLength
21
21
  def convert(from:, to:)
22
22
  assert_all_valid_keys!(from, to, all_keys)
23
23
 
@@ -33,7 +33,7 @@ module Lite
33
33
  convert_to_imperical_units(amount, from: from, convert_to: :meters, convert_from: :inches, to: to)
34
34
  end
35
35
  end
36
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/LineLength
36
+ # rubocop:enable Metrics/MethodLength, Layout/LineLength
37
37
 
38
38
  end
39
39
  end
@@ -7,17 +7,17 @@ module Lite
7
7
  include Lite::Measurements::Helpers::ConversionHelper
8
8
  include Lite::Measurements::Helpers::ShiftHelper
9
9
 
10
- CONVERTER ||= 28.349523125
10
+ CONVERTER = 28.349523125
11
11
 
12
- IMPERICAL_UNITS ||= {
12
+ IMPERICAL_UNITS = {
13
13
  ounces: 1.0, pounds: 16.0, stones: 224.0, us_tons: 32_000.0, imperial_tons: 35_840.0
14
14
  }.freeze
15
- METRIC_UNITS ||= {
15
+ METRIC_UNITS = {
16
16
  micrograms: 0.000001, milligrams: 0.001, centigrams: 0.01, decigrams: 0.1, grams: 1.0,
17
17
  dekagrams: 10.0, hectograms: 100.0, kilograms: 1_000.0, metric_tons: 1_000_000.0
18
18
  }.freeze
19
19
 
20
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/LineLength
20
+ # rubocop:disable Metrics/MethodLength, Layout/LineLength
21
21
  def convert(from:, to:)
22
22
  assert_all_valid_keys!(from, to, all_keys)
23
23
 
@@ -33,7 +33,7 @@ module Lite
33
33
  convert_to_imperical_units(amount, from: from, convert_to: :grams, convert_from: :ounces, to: to)
34
34
  end
35
35
  end
36
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/LineLength
36
+ # rubocop:enable Metrics/MethodLength, Layout/LineLength
37
37
 
38
38
  end
39
39
  end
@@ -4,12 +4,12 @@ module Lite
4
4
  module Measurements
5
5
  class Temperature < Lite::Measurements::Base
6
6
 
7
- C_FREEZING_POINT ||= 5.0 / 9.0
8
- C_INVERSED_POINT ||= 9.0 / 5.0
9
- F_FREEZING_POINT ||= 32.0
10
- K_FREEZING_POINT ||= 273.15
7
+ C_FREEZING_POINT = 5.0 / 9.0
8
+ C_INVERSED_POINT = 9.0 / 5.0
9
+ F_FREEZING_POINT = 32.0
10
+ K_FREEZING_POINT = 273.15
11
11
 
12
- VALID_KEYS ||= %i[
12
+ VALID_KEYS = %i[
13
13
  celsius fahrenheit kelvin
14
14
  ].freeze
15
15
 
@@ -6,7 +6,7 @@ module Lite
6
6
 
7
7
  include Lite::Measurements::Helpers::ShiftHelper
8
8
 
9
- TIME_UNITS ||= {
9
+ TIME_UNITS = {
10
10
  milliseconds: 0.001, seconds: 1.0, minutes: 60.0, hours: 3600.0, days: 86_400.0,
11
11
  weeks: 604_800.0, years: 31_557_600.0, decades: 31_557_600.0 * 10.0,
12
12
  centuries: 31_557_600.0 * 100.0, millenniums: 31_557_600.0 * 1_000.0
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Measurements
5
5
 
6
- VERSION ||= '1.0.2'
6
+ VERSION = '1.1.0'
7
7
 
8
8
  end
9
9
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  )
26
26
  else
27
27
  raise 'RubyGems 2.0 or newer is required to protect against ' \
28
- 'public gem pushes.'
28
+ 'public gem pushes.'
29
29
  end
30
30
 
31
31
  # Specify which files should be added to the gem when it is released.
@@ -44,5 +44,6 @@ Gem::Specification.new do |spec|
44
44
  spec.add_development_dependency 'rspec'
45
45
  spec.add_development_dependency 'rubocop'
46
46
  spec.add_development_dependency 'rubocop-performance'
47
+ spec.add_development_dependency 'rubocop-rake'
47
48
  spec.add_development_dependency 'rubocop-rspec'
48
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lite-measurements
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-24 00:00:00.000000000 Z
11
+ date: 2021-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rubocop-rspec
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +136,7 @@ dependencies:
122
136
  - - ">="
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
- description:
139
+ description:
126
140
  email:
127
141
  - j.gomez@drexed.com
128
142
  executables: []
@@ -169,7 +183,7 @@ homepage: http://drexed.github.io/lite-measurements
169
183
  licenses:
170
184
  - MIT
171
185
  metadata: {}
172
- post_install_message:
186
+ post_install_message:
173
187
  rdoc_options: []
174
188
  require_paths:
175
189
  - lib
@@ -184,8 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
198
  - !ruby/object:Gem::Version
185
199
  version: '0'
186
200
  requirements: []
187
- rubygems_version: 3.0.4
188
- signing_key:
201
+ rubygems_version: 3.2.24
202
+ signing_key:
189
203
  specification_version: 4
190
204
  summary: Convert measurements to different unit sizes or types
191
205
  test_files: []