unit_measurements 5.18.0 → 5.19.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: b79ae2c652b3fa7a2731ff5e199b6dd78597a162355290ae6f761188da5869e7
4
- data.tar.gz: d0f110527d9eb7412614f0117e4b16ba7cc34bdffa94f006b3f679507845a427
3
+ metadata.gz: b62b251d76f21d5e5fbde4d7868c06d20139aa9a1b919fa41d5f7c292313701c
4
+ data.tar.gz: 70eb805f83a66060c0b5143621827195c731567169aeeaa5c0f4a05537b65a67
5
5
  SHA512:
6
- metadata.gz: a1cb45a48dedbc291ab63ab54662a8411acb6549dbdebb4bc6ae3935d1674c879473079e66a108777655703b6da9a519c0b5b76a313161478985af0897a21676
7
- data.tar.gz: 8ef91576d219998cb7fa40edc494302f1ca212fbaeab29da87c3c79c49920ef60893a96feaacc06951fcf9bd1c3fb64e7ad28cb2a8cd774613785ff807aa6a09
6
+ metadata.gz: 06aee82005c8d47f7d981da3a952c1196e95749f20d51636aa79f980a85730b89d4dcbb81a10ff0a6c2249408b8892715ea631325fa64059f42cf7a96cad0193
7
+ data.tar.gz: ad904cbf99b964c071cd1f715e0d8ce313a174e3d48a66eb60892bcb90ec4a9a72c0d5cb8535b0e4edbd3486c0768b36ecbcb28c13cbce4a2d0bdd0c7548bf5c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [5.19.0](https://github.com/shivam091/unit_measurements/compare/v5.18.0...v5.19.0) - 2025-01-12
2
+
3
+ ### What's new
4
+
5
+ - Added US Customary units for square foot (`sq_ft`), square mile (`sq_mi`), and square chain (`sq_ch`).
6
+
7
+ ### What's changed
8
+
9
+ - Changed symbol of units `cb (M)` and `cb (US)` to `metric_cb` and `us_cb` in `length`.
10
+ - Changed symbol of unit `hp (M)` to `metric_hp` in `power`.
11
+ - Changed symbol of unit `cwt (US)` to `us_cwt` in `weight`.
12
+
13
+ ----------
14
+
1
15
  ## [5.18.0](https://github.com/shivam091/unit_measurements/compare/v5.17.0...v5.18.0) - 2023-12-16
2
16
 
3
17
  ### What's new
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unit_measurements (5.18.0)
4
+ unit_measurements (5.19.0)
5
5
  activesupport (~> 7.0)
6
6
 
7
7
  GEM
@@ -202,6 +202,14 @@ module UnitMeasurements
202
202
  ["Q", %w[quetta], 1e+30]
203
203
  ].map(&:freeze).freeze
204
204
 
205
+ # Prefixes for SI binary units and SI decimal units.
206
+ #
207
+ # @see SI_BINARY_PREFIXES
208
+ # @see SI_DECIMAL_PREFIXES
209
+ # @author {Harshal V. Ladhe}[https://shivam091.github.io/]
210
+ # @since 5.19.0
211
+ SI_PREFIXES = SI_BINARY_PREFIXES + SI_DECIMAL_PREFIXES
212
+
205
213
  # Parses tokens and returns a +conversion value+ and the +unit+.
206
214
  #
207
215
  # This method is used internally to parse the conversion value of the unit
@@ -165,7 +165,7 @@ module UnitMeasurements
165
165
  def build_si_units(name, value:, add_binary_prefixes:, aliases:)
166
166
  si_units = [build_unit(name, value: value, aliases: aliases)]
167
167
 
168
- si_prefixes = add_binary_prefixes ? (Unit::SI_DECIMAL_PREFIXES + Unit::SI_BINARY_PREFIXES) : Unit::SI_DECIMAL_PREFIXES
168
+ si_prefixes = add_binary_prefixes ? Unit::SI_PREFIXES : Unit::SI_DECIMAL_PREFIXES
169
169
 
170
170
  si_prefixes.each do |short_prefix, long_prefix, multiplier|
171
171
  si_aliases = long_prefix.product(aliases.to_a).flat_map do |prefix, unit|
@@ -34,10 +34,14 @@ UnitMeasurements::Area = UnitMeasurements.build do
34
34
  unit "sec", value: "640 ac", aliases: ["sect", "section", "sections"]
35
35
  unit "twp", value: "36 sec", aliases: ["survey township", "survey townships"]
36
36
 
37
- unit "ac (US)", value: "4046.873 m²", aliases: ["acre (US)", "acres (US)"]
37
+ unit "us_ac", value: "4046.873 m²", aliases: ["us acre", "us acres"]
38
38
  unit "ft² (US)", value: "0.09290341161327482 m²", aliases: ["ft^2 (US)", "sq ft (US)", "square foot (US)", "square feet (US)"]
39
39
  unit "mi² (US)", value: "2.58999847e+6 m²", aliases: ["mi^2 (US)", "sq mi (US)", "square mile (US)", "square miles (US)"]
40
40
  unit "ch² (US)", value: "404.6873 m²", aliases: ["ch^2 (US)", "sq ch (US)", "square chain (US)", "square chains (US)"]
41
+
42
+ unit "sq_ft", value: "0.09290341161327482 m²", aliases: ["us square foot", "us square feet"]
43
+ unit "sq_mi", value: "2.58999847e+6 m²", aliases: ["us square mile", "us square miles"]
44
+ unit "sq_ch", value: "404.6873 m²", aliases: ["us square chain", "us square chains"]
41
45
  end
42
46
 
43
47
  system :planck_units do
@@ -11,7 +11,7 @@ UnitMeasurements::Length = UnitMeasurements.build do
11
11
  unit "Å", value: "1e-10 m", aliases: ["angstrom", "angstroms", "ångström"]
12
12
  unit "μ", value: "1 μm", aliases: ["micron", "microns"]
13
13
 
14
- unit "cb (M)", value: "185.2 m", aliases: ["CBL. (M)", "cable length (M)"]
14
+ unit "metric_cb", value: "185.2 m", aliases: ["metric cable length"]
15
15
  end
16
16
 
17
17
  system :imperial do
@@ -25,7 +25,7 @@ UnitMeasurements::Length = UnitMeasurements.build do
25
25
  unit "th", value: "1/1000 in", aliases: ["thou", "thousandth of an inch", "mil", "mils"]
26
26
  unit "nl", value: "3 nmi", aliases: ["NL", "nleague", "nleagues", "nautical league", "nautical leagues"]
27
27
  unit "rd", value: "16 1/2 ft", aliases: ["rod", "rods", "perch", "pole", "lug"]
28
- unit "cb", value: "608 ft", aliases: ["CBL.", "cable length"]
28
+ unit "cb", value: "608 ft", aliases: ["cable length"]
29
29
  unit "qr", value: "1/4 yd", aliases: ["quarter", "quarters"]
30
30
  unit "bc", value: "1/3 in", aliases: ["b.c.", "barleycorn", "barleycorns"]
31
31
 
@@ -41,7 +41,7 @@ UnitMeasurements::Length = UnitMeasurements.build do
41
41
  unit "U", value: "1.75 in", aliases: ["RU", "rack unit", "rack units"]
42
42
  unit "sft", value: "1200/3937 m", aliases: ["sfoot", "sfeet", "survey-foot", "survey-feet"]
43
43
 
44
- unit "cb (US)", value: "720 ft", aliases: ["CBL. (US)", "cable length (US)"]
44
+ unit "us_cb", value: "720 ft", aliases: ["us cable length"]
45
45
  end
46
46
 
47
47
  system :astronomical do
@@ -10,7 +10,7 @@ UnitMeasurements::Power = UnitMeasurements.build do
10
10
 
11
11
  unit "p", value: "980.665 W", aliases: ["poncelet", "poncelets"]
12
12
 
13
- unit "hp (M)", value: "735.49875 W", aliases: ["PS", "metric horsepower"]
13
+ unit "metric_hp", value: "735.49875 W", aliases: ["PS", "metric horsepower"]
14
14
 
15
15
  unit "kgf⋅m", value: "9.80665 W", aliases: ["kgf*m", "kilogramme-force meter", "kilogram-force meter"]
16
16
  unit "erg/s", value: "1e-7 W", aliases: ["erg per second", "ergs per second"]
@@ -37,8 +37,8 @@ UnitMeasurements::Weight = UnitMeasurements.build do
37
37
 
38
38
  system :us_customary do
39
39
  unit "tn", value: "2000 lb", aliases: ["ton", "tons", "short ton", "short tons"]
40
- unit "us qr", value: "1/4 cwt (US)", aliases: ["us qtr", "us quarter", "us quarters"]
41
- unit "cwt (US)", value: "100 lb", aliases: ["hundredweight (US)", "short hundredweight"]
40
+ unit "us_qr", value: "1/4 us_cwt", aliases: ["us qtr", "us quarter", "us quarters"]
41
+ unit "us_cwt", value: "100 lb", aliases: ["us hundredweight", "short hundredweight"]
42
42
  end
43
43
 
44
44
  system :gravitational_metric do
@@ -4,5 +4,5 @@
4
4
 
5
5
  module UnitMeasurements
6
6
  # Current stable version.
7
- VERSION = "5.18.0"
7
+ VERSION = "5.19.0"
8
8
  end
data/units.md CHANGED
@@ -32,7 +32,7 @@ These units are defined in `UnitMeasurements::Length`.
32
32
  | 13 | pc | parsec, parsecs |
33
33
  | 14 | nl | NL, nleague, nleagues, nautical league, nautical leagues |
34
34
  | 15 | rd | rod, rods, perch, pole, lug |
35
- | 16 | cb | CBL., cable length |
35
+ | 16 | cb | cable length |
36
36
  | 17 | ls | light-second, light-seconds |
37
37
  | 18 | lh | light-hour, light-hours |
38
38
  | 19 | ld | light-day, light-days |
@@ -47,8 +47,8 @@ These units are defined in `UnitMeasurements::Length`.
47
47
  | 28 | sft | sfoot, sfeet, survey-foot, survey-feet |
48
48
  | 29 | bc | b.c., barleycorn, barleycorns |
49
49
  | 30 | lmin | light-minute, light-minutes |
50
- | 31 | cb (M) | CBL. (M), cable length (M) |
51
- | 32 | cb (US) | CBL. (US), cable length (US) |
50
+ | 31 | metric_cb | metric cable length |
51
+ | 32 | us_cb | us cable length |
52
52
  | 33 | lₚ | planck length, quantum length |
53
53
  | 34 | qr | quarter, quarters |
54
54
  | 35 | U | RU, rack unit, rack units |
@@ -81,11 +81,11 @@ These units are defined in `UnitMeasurements::Weight`.
81
81
  | 19 | hyl | mug, metric slug, metric slugs, hyls |
82
82
  | 20 | cwt | hundredweight, long hundredweight, imperial hundredweight |
83
83
  | 21 | slug | slugs |
84
- | 22 | cwt (US) | hundredweight (US), short hundredweight |
84
+ | 22 | us_cwt | us hundredweight, short hundredweight |
85
85
  | 23 | mₚ | planck mass, quantum mass |
86
86
  | 24 | qr | qtr, quarter, quarters |
87
87
  | 25 | fir | firkin, firkins |
88
- | 26 | us qr | us qtr, us quarter, us quarters |
88
+ | 26 | us_qr | us qtr, us quarter, us quarters |
89
89
 
90
90
  ## 3. Time or duration
91
91
 
@@ -168,7 +168,7 @@ These units are defined in `UnitMeasurements::Area`.
168
168
  | 14 | fur² | fur^2, sq fur, square furlong, square furlongs |
169
169
  | 15 | rd² | rd^2, sq rd, square rod, square rods |
170
170
  | 16 | lnk² | link^2, sq lnk, square link, square links |
171
- | 17 | ac (US) | acre (US), acres (US) |
171
+ | 17 | us_ac | us acre, us acres |
172
172
  | 18 | ft² (US) | ft^2 (US), sq ft (US), square foot (US), square feet (US) |
173
173
  | 19 | mi² (US) | mi^2 (US), sq mi (US), square mile (US), square miles (US) |
174
174
  | 20 | ch² (US) | ch^2 (US), sq ch (US), square chain (US), square chains (US) |
@@ -176,6 +176,9 @@ These units are defined in `UnitMeasurements::Area`.
176
176
  | 22 | dun | ḍn, dunam, dunams |
177
177
  | 23 | sec | sect, section, sections |
178
178
  | 24 | twp | survey township, survey townships |
179
+ | 25 | sq_ft | us square foot, us square feet |
180
+ | 26 | sq_mi | us square mile, us square miles |
181
+ | 27 | sq_ch | us square chain, us square chains |
179
182
 
180
183
  ## 9. Volume & capacity
181
184
 
@@ -700,7 +703,7 @@ These units are defined in `UnitMeasurements::Power`.
700
703
  |:--|:--|:--|
701
704
  | _1_ | _W*_ | _watt, watts_ |
702
705
  | 2 | p | poncelet, poncelets |
703
- | 3 | hp (M) | PS, metric horsepower |
706
+ | 3 | metric_hp | PS, metric horsepower |
704
707
  | 4 | kgf⋅m | kgf*m, kilogramme-force meter, kilogram-force meter |
705
708
  | 5 | cal/s | calorie per second, calories per second |
706
709
  | 6 | cal/min | calorie per minute, calories per minute |
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unit_measurements
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.18.0
4
+ version: 5.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harshal LADHE
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-11 00:00:00.000000000 Z
11
+ date: 2025-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport