unit_measurements 4.10.0 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/unit_measurements/unit_groups/area.rb +7 -0
- data/lib/unit_measurements/unit_groups/length.rb +12 -1
- data/lib/unit_measurements/unit_groups/volume.rb +10 -0
- data/lib/unit_measurements/unit_groups/weight.rb +22 -0
- data/lib/unit_measurements/version.rb +1 -1
- data/units.md +39 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 50b4c09e16a4111f9776ae68ed43e33eccb5b2d47e6146bd32711bdaa8a72cf7
|
|
4
|
+
data.tar.gz: 1a5c0339f687684b6bb34f2bf53d9da7fd1ed8eba23bcc0c23fbc4634057dfb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee23a940d4596e69a28f5361d037b88df37bf0d31c4b4f86a5cd11a33f201eb2f0dcf54a1579d75e54f1d5989c27751a745d755073f0d6fe5be459846daa17d1
|
|
7
|
+
data.tar.gz: aa2cd86031ecd07894fd8c0258367ae2e5bd24e4155a1137dc201a3a4bb450aa9823afc936a24db71f15b17d8bf03ba8e5a1d5516ed9ffc155059907e46e347d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [4.12.0](https://github.com/shivam091/unit_measurements/compare/v4.11.0...v4.12.0) - 2023-10-16
|
|
2
|
+
|
|
3
|
+
### What's new
|
|
4
|
+
|
|
5
|
+
- Added new units in `area` (are, barn, hectare, acre, square chain, square furlong, square rod) unit group.
|
|
6
|
+
- Added new units in `volume` (cup, quart, gill, pint, gallon, barrel, teaspoon, tablespoon, fluid ounce) unit group.
|
|
7
|
+
|
|
8
|
+
----------
|
|
9
|
+
|
|
10
|
+
## [4.11.0](https://github.com/shivam091/unit_measurements/compare/v4.10.0...v4.11.0) - 2023-10-15
|
|
11
|
+
|
|
12
|
+
### What's new
|
|
13
|
+
|
|
14
|
+
- Added new units in `length` (ch, th, ftm, fur, nmi, rod, au, pc) unit group.
|
|
15
|
+
- Added new units in `weight` (ct, Da, lb, st, oz, gr, ozt, dwt, dr, slug) unit group.
|
|
16
|
+
|
|
17
|
+
----------
|
|
18
|
+
|
|
1
19
|
## [4.10.0](https://github.com/shivam091/unit_measurements/compare/v4.9.0...v4.10.0) - 2023-10-14
|
|
2
20
|
|
|
3
21
|
### What's new
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A library that encapsulate measurements and their units in Ruby.
|
|
|
9
9
|
[](https://codeclimate.com/github/shivam091/unit_measurements/test_coverage)
|
|
10
10
|
[](https://github.com/shivam091/unit_measurements/blob/main/LICENSE.md)
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
[Harshal V. Ladhe, Master of Computer Science.](https://shivam091.github.io)
|
|
13
13
|
|
|
14
14
|
## Introduction
|
|
15
15
|
|
|
@@ -431,4 +431,4 @@ Volume = UnitMeasurements::Volume
|
|
|
431
431
|
|
|
432
432
|
## License
|
|
433
433
|
|
|
434
|
-
Copyright 2023 [Harshal V. LADHE](https://github.
|
|
434
|
+
Copyright 2023 [Harshal V. LADHE]((https://shivam091.github.io)), Released under the [MIT License](http://opensource.org/licenses/MIT).
|
|
@@ -6,14 +6,21 @@ UnitMeasurements::Area = UnitMeasurements.build do
|
|
|
6
6
|
primitive "m²"
|
|
7
7
|
|
|
8
8
|
system :metric do
|
|
9
|
+
unit "a", value: "100 m²", aliases: ["are", "ares"]
|
|
10
|
+
unit "b", value: "1e-28 m²", aliases: ["barn", "barns"]
|
|
9
11
|
unit "m²", aliases: ["m^2", "sq m", "square meter", "square meters", "square metre", "square metres"]
|
|
12
|
+
unit "ha", value: "10000 m²", aliases: ["hectare", "hectares"]
|
|
10
13
|
unit "km²", value: "1e+6 m²", aliases: ["km^2", "sq km", "square kilometer", "square kilometers", "square kilometre", "square kilometres"]
|
|
11
14
|
end
|
|
12
15
|
|
|
13
16
|
system :imperial do
|
|
17
|
+
unit "ac", value: "4046.8564224 m²", aliases: ["acre", "acres"]
|
|
14
18
|
unit "in²", value: "0.00064516 m²", aliases: ["in^2", "sq in", "square inch", "square inches"]
|
|
15
19
|
unit "ft²", value: "144 in²", aliases: ["ft^2", "sq ft", "square foot", "square feet"]
|
|
16
20
|
unit "yd²", value: "9 ft²", aliases: ["yd^2", "sq yd", "square yard", "square yards"]
|
|
17
21
|
unit "mi²", value: "3097600 yd²", aliases: ["mi^2", "sq mi", "square mile", "square miles"]
|
|
22
|
+
unit "ch²", value: "484 yd²", aliases: ["ch^2", "sq ch", "square chain", "square chains"]
|
|
23
|
+
unit "fur²", value: "48400 yd²", aliases: ["fur^2", "sq fur", "square furlong", "square furlongs"]
|
|
24
|
+
unit "rod²", value: "272 1/4 ft²", aliases: ["rod^2", "sq rod", "square rod", "square rods"]
|
|
18
25
|
end
|
|
19
26
|
end
|
|
@@ -13,6 +13,17 @@ UnitMeasurements::Length = UnitMeasurements.build do
|
|
|
13
13
|
unit "in", value: "25.4 mm", aliases: ['"', "inch", "inches"]
|
|
14
14
|
unit "ft", value: "12 in", aliases: ["'", "foot", "feet"]
|
|
15
15
|
unit "yd", value: "3 ft", aliases: ["yard", "yards"]
|
|
16
|
-
unit "mi", value: "1760 yd", aliases: ["mile", "miles"]
|
|
16
|
+
unit "mi", value: "1760 yd", aliases: ["mile", "miles", "statute mile", "international mile"]
|
|
17
|
+
unit "ch", value: "22 yd", aliases: ["chain", "chains"]
|
|
18
|
+
unit "th", value: "1/1000 in", aliases: ["thou", "thousandth of an inch"]
|
|
19
|
+
unit "ftm", value: "6 ft", aliases: ["fathom", "fathoms"]
|
|
20
|
+
unit "fur", value: "220 yd", aliases: ["furlong", "furlongs"]
|
|
21
|
+
unit "nmi", value: "1852 m", aliases: ["NMI", "M", "NM", "nautical mile", "nautical miles"]
|
|
22
|
+
unit "rod", value: "16 1/2 ft", aliases: ["rods", "perch", "pole", "lug"]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
system :astronomical do
|
|
26
|
+
unit "au", value: "149597870700 m", aliases: ["astronomical unit", "astronomical units"]
|
|
27
|
+
unit "pc", value: [Rational(648000, Math::PI), "au"], aliases: ["parsec", "parsecs"]
|
|
17
28
|
end
|
|
18
29
|
end
|
|
@@ -20,5 +20,15 @@ UnitMeasurements::Volume = UnitMeasurements.build do
|
|
|
20
20
|
unit "ft³", value: "1728 in³", aliases: ["ft^3", "cu ft", "cubic foot", "cubic feet"]
|
|
21
21
|
unit "yd³", value: "27 ft³", aliases: ["yd^3", "cu yd", "cubic yard", "cubic yards"]
|
|
22
22
|
unit "mi³", value: "5451776000 yd³", aliases: ["mi^3", "cu mi", "cubic mile", "cubic miles"]
|
|
23
|
+
|
|
24
|
+
unit "c", value: "284.130625e-6 m³", aliases: ["cup", "cups"]
|
|
25
|
+
unit "qt", value: "0.0011365225 m³", aliases: ["quart", "quarts"]
|
|
26
|
+
unit "gi", value: "1/2 c", aliases: ["gill", "gills"]
|
|
27
|
+
unit "pt", value: "1/8 gal", aliases: ["pint", "pints"]
|
|
28
|
+
unit "gal", value: "4.54609 dm³", aliases: ["gallon", "gallons"]
|
|
29
|
+
unit "bbl", value: "36 gal", aliases: ["barrel", "barrels"]
|
|
30
|
+
unit "tsp", value: "1/24 gi", aliases: ["teaspoon", "teaspoons"]
|
|
31
|
+
unit "tbsp", value: "3 tsp", aliases: ["tbs", "tablespoon", "tablespoons"]
|
|
32
|
+
unit "floz", value: "1/160 gal", aliases: ["fluid ounce", "fluid ounces"]
|
|
23
33
|
end
|
|
24
34
|
end
|
|
@@ -10,5 +10,27 @@ UnitMeasurements::Weight = UnitMeasurements.build do
|
|
|
10
10
|
|
|
11
11
|
unit "q", value: "100 kg", aliases: ["quintal", "quintals"]
|
|
12
12
|
unit "t", value: "1000 kg", aliases: ["tonne", "tonnes", "metric tonne", "metric tonnes"]
|
|
13
|
+
unit "ct", value: "200 mg", aliases: ["carat", "carats"]
|
|
14
|
+
unit "Da", value: "1.660538921e-27 kg", aliases: ["dalton", "daltons"]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
system :imperial do
|
|
18
|
+
unit "lb", value: [Rational(45_359_237, 1e+8), "kg"], aliases: ["lbs", "lbm", "pound-mass", "pound", "pounds", "#"]
|
|
19
|
+
unit "st", value: "14 lb", aliases: ["stone", "stones"]
|
|
20
|
+
unit "oz", value: [Rational(1, 16), "lb"], aliases: ["ounce", "ounces"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
system :troy_weight do
|
|
24
|
+
unit "gr", value: [Rational(1, 7000), "lb"], aliases: ["grain", "grains"]
|
|
25
|
+
unit "ozt", value: "480 gr", aliases: ["troy ounce", "troy ounces"]
|
|
26
|
+
unit "dwt", value: [Rational(1, 20), "ozt"], aliases: ["pennyweight", "pennyweights"]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
system :avoirdupois do
|
|
30
|
+
unit "dr", value: [Rational(1, 16), "oz"], aliases: ["dram", "drams"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
system :foot_pound_second do
|
|
34
|
+
unit "slug", value: "32.1740 lb", aliases: ["slugs"]
|
|
13
35
|
end
|
|
14
36
|
end
|
data/units.md
CHANGED
|
@@ -17,7 +17,15 @@ These units are defined in `UnitMeasurements::Length`.
|
|
|
17
17
|
| 2 | in | ", inch, inches |
|
|
18
18
|
| 3 | ft | ', foot, feet |
|
|
19
19
|
| 4 | yd | yard, yards |
|
|
20
|
-
| 5 | mi | mile, miles |
|
|
20
|
+
| 5 | mi | mile, miles, statute mile, international mile |
|
|
21
|
+
| 6 | ch | chain, chains |
|
|
22
|
+
| 7 | th | thou, thousandth of an inch |
|
|
23
|
+
| 8 | au | astronomical unit, astronomical units |
|
|
24
|
+
| 9 | pc | parsec, parsecs |
|
|
25
|
+
| 10 | ftm | fathom, fathoms |
|
|
26
|
+
| 11 | fur | furlong, furlongs |
|
|
27
|
+
| 12 | nmi | NMI, M, NM, nautical mile, nautical miles |
|
|
28
|
+
| 13 | rod | rods, perch, pole, lug |
|
|
21
29
|
|
|
22
30
|
## 2. Weight/Mass
|
|
23
31
|
|
|
@@ -28,6 +36,16 @@ These units are defined in `UnitMeasurements::Weight`.
|
|
|
28
36
|
| _1_ | _g*_ | _gram, grams, gramme, grammes_ |
|
|
29
37
|
| 2 | q | quintal, quintals |
|
|
30
38
|
| 3 | t | tonne, tonnes, metric tonne, metric tonnes |
|
|
39
|
+
| 4 | ct | carat, carats |
|
|
40
|
+
| 5 | Da | dalton, daltons |
|
|
41
|
+
| 6 | st | stone, stones |
|
|
42
|
+
| 7 | dr | dram, drams |
|
|
43
|
+
| 8 | dwt | pennyweight, pennyweights |
|
|
44
|
+
| 9 | ozt | troy ounce, troy ounces |
|
|
45
|
+
| 10 | slug | slugs |
|
|
46
|
+
| 11 | lb | lbs, lbm, pound-mass, pound, pounds, \# |
|
|
47
|
+
| 12 | oz | ounce, ounces |
|
|
48
|
+
| 13 | gr | grain, grains |
|
|
31
49
|
|
|
32
50
|
## 3. Time
|
|
33
51
|
|
|
@@ -93,10 +111,17 @@ These units are defined in `UnitMeasurements::Area`.
|
|
|
93
111
|
|:--|:--|:--|
|
|
94
112
|
| _1_ | _m²_ | _m^2, sq m, square meter, square meters, square metre, square metres_ |
|
|
95
113
|
| 2 | km² | km^2, sq km, square kilometer, square kilometers, square kilometre, square kilometres |
|
|
96
|
-
| 3 |
|
|
97
|
-
| 4 |
|
|
98
|
-
| 5 |
|
|
99
|
-
| 6 |
|
|
114
|
+
| 3 | a | are, ares |
|
|
115
|
+
| 4 | b | barn, barns |
|
|
116
|
+
| 5 | ha | hectare, hectares |
|
|
117
|
+
| 6 | ac | acre, acres |
|
|
118
|
+
| 7 | in² | in^2, sq in, square inch, square inches |
|
|
119
|
+
| 8 | ft² | ft^2, sq ft, square foot, square feet |
|
|
120
|
+
| 9 | yd² | yd^2, sq yd, square yard, square yards |
|
|
121
|
+
| 10 | mi² | mi^2, sq mi, square mile, square miles |
|
|
122
|
+
| 11 | ch² | ch^2, sq ch, square chain, square chains |
|
|
123
|
+
| 12 | fur² | fur^2, sq fur, square furlong, square furlongs |
|
|
124
|
+
| 13 | rod² | rod^2, sq rod, square rod, square rods |
|
|
100
125
|
|
|
101
126
|
## 9. Volume
|
|
102
127
|
|
|
@@ -114,6 +139,15 @@ These units are defined in `UnitMeasurements::Volume`.
|
|
|
114
139
|
| 8 | ft³ | ft^3, cu ft, cubic foot, cubic feet |
|
|
115
140
|
| 9 | yd³ | yd^3, cu yd, cubic yard, cubic yards |
|
|
116
141
|
| 10 | mi³ | mi^3, cu mi, cubic mile, cubic miles |
|
|
142
|
+
| 11 | c | cup, cups |
|
|
143
|
+
| 12 | qt | quart, quarts |
|
|
144
|
+
| 13 | gi | gill, gills |
|
|
145
|
+
| 14 | pt | pint, pints |
|
|
146
|
+
| 15 | gal | gallon, gallons |
|
|
147
|
+
| 16 | bbl | barrel, barrels |
|
|
148
|
+
| 17 | tsp | teaspoon, teaspoons |
|
|
149
|
+
| 18 | tbsp | tbs, tablespoon, tablespoons |
|
|
150
|
+
| 19 | floz | fluid ounce, fluid ounces |
|
|
117
151
|
|
|
118
152
|
## 10. Density
|
|
119
153
|
|
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: 4.
|
|
4
|
+
version: 4.12.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: 2023-10-
|
|
11
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|