unit_measurements 5.15.0 → 5.16.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 +9 -1
- data/Gemfile.lock +1 -1
- data/README.md +42 -76
- data/lib/unit_measurements/unit_groups/acceleration.rb +4 -0
- data/lib/unit_measurements/unit_groups/area.rb +4 -0
- data/lib/unit_measurements/unit_groups/density.rb +4 -0
- data/lib/unit_measurements/unit_groups/electric_charge.rb +4 -0
- data/lib/unit_measurements/unit_groups/electric_current.rb +4 -0
- data/lib/unit_measurements/unit_groups/energy.rb +4 -0
- data/lib/unit_measurements/unit_groups/force.rb +4 -0
- data/lib/unit_measurements/unit_groups/length.rb +4 -0
- data/lib/unit_measurements/unit_groups/power.rb +4 -0
- data/lib/unit_measurements/unit_groups/pressure.rb +4 -0
- data/lib/unit_measurements/unit_groups/temperature.rb +4 -0
- data/lib/unit_measurements/unit_groups/time.rb +4 -0
- data/lib/unit_measurements/unit_groups/volume.rb +4 -0
- data/lib/unit_measurements/unit_groups/weight.rb +4 -0
- data/lib/unit_measurements/version.rb +1 -1
- data/units.md +16 -2
- 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: fcdf50759b2e50022f7dc5b4661a5ad149c781f0cc39f1f6f1c21825b8dec89d
|
|
4
|
+
data.tar.gz: 6ca3e101ab49cce3c7f6b6c177373cf70187e677135f9daee6ee33d7a8154bf2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80b49c55971a01de943c2b7b5638debc16a49c9c68ee38bf84df62168a1d366fa80c12870cf483564350127b7bbc17cbb012e9947ecba7076699e4300458f248
|
|
7
|
+
data.tar.gz: c185e222fc88a2bc91ad232a004ef31e22669b16c4690eaefeff12b16e665d9cb6964f2504339fb0a70d0aa5f668fd085113a7232b9b08df93217f72f273bcd0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
## [5.
|
|
1
|
+
## [5.16.0](https://github.com/shivam091/unit_measurements/compare/v5.15.0...v5.16.0) - 2023-12-13
|
|
2
|
+
|
|
3
|
+
### What's new
|
|
4
|
+
|
|
5
|
+
- Added planck units and their conversions.
|
|
6
|
+
|
|
7
|
+
----------
|
|
8
|
+
|
|
9
|
+
## [5.15.0](https://github.com/shivam091/unit_measurements/compare/v5.14.0...v5.15.0) - 2023-12-11
|
|
2
10
|
|
|
3
11
|
### What's new
|
|
4
12
|
|
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
|
-
[Harshal V. Ladhe, Master of Computer Science.](https://shivam091.github.io)
|
|
12
|
+
**[Harshal V. Ladhe, Master of Computer Science.](https://shivam091.github.io)**
|
|
13
13
|
|
|
14
14
|
## Introduction
|
|
15
15
|
|
|
@@ -47,8 +47,7 @@ Users are advised to cross-verify conversions for their specific use cases._
|
|
|
47
47
|
|
|
48
48
|
## Installation
|
|
49
49
|
|
|
50
|
-
To use `unit_measurements` in your Rails application, add the
|
|
51
|
-
following line to your Gemfile:
|
|
50
|
+
To use `unit_measurements` in your Rails application, add the following line to your Gemfile:
|
|
52
51
|
|
|
53
52
|
```ruby
|
|
54
53
|
gem "unit_measurements"
|
|
@@ -88,8 +87,7 @@ viz., `UnitMeasurements::Weight`, `UnitMeasurements::Length`, etc.
|
|
|
88
87
|
**Initialize a measurement:**
|
|
89
88
|
|
|
90
89
|
```ruby
|
|
91
|
-
UnitMeasurements::Length.new(1, "km")
|
|
92
|
-
#=> 1 km
|
|
90
|
+
UnitMeasurements::Length.new(1, "km") #=> 1 km
|
|
93
91
|
```
|
|
94
92
|
|
|
95
93
|
**Converting to other units:**
|
|
@@ -103,22 +101,19 @@ These methods provide `use_cache` parameter which defaults to `false` to indicat
|
|
|
103
101
|
You can use `#convert_to` as:
|
|
104
102
|
|
|
105
103
|
```ruby
|
|
106
|
-
UnitMeasurements::Length.new(1, "km").convert_to("m", use_cache: true)
|
|
107
|
-
#=> 1000.0 m
|
|
104
|
+
UnitMeasurements::Length.new(1, "km").convert_to("m", use_cache: true) #=> 1000.0 m
|
|
108
105
|
```
|
|
109
106
|
|
|
110
107
|
If you want to modify measurement object itself, you can use `#convert_to!` method as:
|
|
111
108
|
|
|
112
109
|
```ruby
|
|
113
|
-
UnitMeasurements::Length.new(1, "km").convert_to!("m")
|
|
114
|
-
#=> 1000.0 m
|
|
110
|
+
UnitMeasurements::Length.new(1, "km").convert_to!("m") #=> 1000.0 m
|
|
115
111
|
```
|
|
116
112
|
|
|
117
113
|
You can convert the measurement directly to the `primitive` unit of the unit group as:
|
|
118
114
|
|
|
119
115
|
```ruby
|
|
120
|
-
UnitMeasurements::Length.new(1, "cm").to_primitive
|
|
121
|
-
#=> 0.01 m
|
|
116
|
+
UnitMeasurements::Length.new(1, "cm").to_primitive #=> 0.01 m
|
|
122
117
|
```
|
|
123
118
|
|
|
124
119
|
Note: `#to_primitive` method is aliased as `#in_primitive` and `#as_primitive`.
|
|
@@ -128,8 +123,7 @@ Note: `#to_primitive` method is aliased as `#in_primitive` and `#as_primitive`.
|
|
|
128
123
|
This method provides `use_cache` parameter which defaults to `false` to indicate whether the caching of conversion factors should happen.
|
|
129
124
|
|
|
130
125
|
```ruby
|
|
131
|
-
UnitMeasurements::Length.parse("1 km")
|
|
132
|
-
#=> 1.0 km
|
|
126
|
+
UnitMeasurements::Length.parse("1 km") #=> 1.0 km
|
|
133
127
|
```
|
|
134
128
|
|
|
135
129
|
**Parse string that mentions quantity, source unit, and target unit:**
|
|
@@ -137,17 +131,14 @@ UnitMeasurements::Length.parse("1 km")
|
|
|
137
131
|
A source unit can be separated from the target unit using the `in`, `to`, or `as` operators.
|
|
138
132
|
|
|
139
133
|
```ruby
|
|
140
|
-
UnitMeasurements::Length.parse("1 km to m")
|
|
141
|
-
#=> 1000.0 m
|
|
134
|
+
UnitMeasurements::Length.parse("1 km to m") #=> 1000.0 m
|
|
142
135
|
```
|
|
143
136
|
|
|
144
137
|
**Parse scientific numbers, source unit, and (or) target unit:**
|
|
145
138
|
|
|
146
139
|
```ruby
|
|
147
|
-
UnitMeasurements::Length.parse("2e+2 km").convert_to("m")
|
|
148
|
-
#=> 200000.0 m
|
|
149
|
-
UnitMeasurements::Length.parse("2e+2 km to m")
|
|
150
|
-
#=> 200000.0 m
|
|
140
|
+
UnitMeasurements::Length.parse("2e+2 km").convert_to("m") #=> 200000.0 m
|
|
141
|
+
UnitMeasurements::Length.parse("2e+2 km to m") #=> 200000.0 m
|
|
151
142
|
```
|
|
152
143
|
You can check supported special characters for exponents
|
|
153
144
|
[here](https://shivam091.github.io/unit_measurements/UnitMeasurements/Normalizer.html).
|
|
@@ -155,19 +146,15 @@ You can check supported special characters for exponents
|
|
|
155
146
|
**Parse complex numbers, source unit, and (or) target unit:**
|
|
156
147
|
|
|
157
148
|
```ruby
|
|
158
|
-
UnitMeasurements::Length.parse("2+3i km").convert_to("m")
|
|
159
|
-
#=> 2000.0+3000.0i m
|
|
160
|
-
UnitMeasurements::Length.parse("2+3i km to m")
|
|
161
|
-
#=> 2000.0+3000.0i m
|
|
149
|
+
UnitMeasurements::Length.parse("2+3i km").convert_to("m") #=> 2000.0+3000.0i m
|
|
150
|
+
UnitMeasurements::Length.parse("2+3i km to m") #=> 2000.0+3000.0i m
|
|
162
151
|
```
|
|
163
152
|
|
|
164
153
|
**Parse fractional/mixed fractional numbers, source unit, and (or) target unit:**
|
|
165
154
|
|
|
166
155
|
```ruby
|
|
167
|
-
UnitMeasurements::Length.parse("2 ½ km").convert_to("m")
|
|
168
|
-
#=>
|
|
169
|
-
UnitMeasurements::Length.parse("2/3 km to m")
|
|
170
|
-
#=> 666.666666666667 m
|
|
156
|
+
UnitMeasurements::Length.parse("2 ½ km").convert_to("m") #=> 2500.0 m
|
|
157
|
+
UnitMeasurements::Length.parse("2/3 km to m") #=> 666.666666666667 m
|
|
171
158
|
```
|
|
172
159
|
|
|
173
160
|
You can check supported special characters for fractional notations
|
|
@@ -176,17 +163,14 @@ You can check supported special characters for fractional notations
|
|
|
176
163
|
**Parse ratios, source unit, and (or) target unit:**
|
|
177
164
|
|
|
178
165
|
```ruby
|
|
179
|
-
UnitMeasurements::Length.parse("1:2 km").convert_to("m")
|
|
180
|
-
#=> 500.0 m
|
|
181
|
-
UnitMeasurements::Length.parse("1:2 km to m")
|
|
182
|
-
#=> 500.0 m
|
|
166
|
+
UnitMeasurements::Length.parse("1:2 km").convert_to("m") #=> 500.0 m
|
|
167
|
+
UnitMeasurements::Length.parse("1:2 km to m") #=> 500.0 m
|
|
183
168
|
```
|
|
184
169
|
|
|
185
170
|
**Calculate the ratio between two units:**
|
|
186
171
|
|
|
187
172
|
```ruby
|
|
188
|
-
UnitMeasurements::Length.ratio("in", "ft")
|
|
189
|
-
#=> "12.0 in/ft"
|
|
173
|
+
UnitMeasurements::Length.ratio("in", "ft") #=> "12.0 in/ft"
|
|
190
174
|
```
|
|
191
175
|
|
|
192
176
|
**Formatting measurement:**
|
|
@@ -195,8 +179,7 @@ If you want to format the measurement to certain format, you can use `#to_fs` me
|
|
|
195
179
|
If format is not specified, it defaults to `"%.2<value>f %<unit>s"`.
|
|
196
180
|
|
|
197
181
|
```ruby
|
|
198
|
-
UnitMeasurements::Length.new(100, "m").to("in").to_fs("%.4<quantity>f %<unit>s")
|
|
199
|
-
#=> "3937.0079 in"
|
|
182
|
+
UnitMeasurements::Length.new(100, "m").to("in").to_fs("%.4<quantity>f %<unit>s") #=> "3937.0079 in"
|
|
200
183
|
```
|
|
201
184
|
|
|
202
185
|
You can check more about formatting along with their examples
|
|
@@ -206,26 +189,23 @@ You can check more about formatting along with their examples
|
|
|
206
189
|
|
|
207
190
|
```ruby
|
|
208
191
|
length = UnitMeasurements::Length.new(1, "km")
|
|
209
|
-
length.quantity
|
|
210
|
-
#=>
|
|
211
|
-
length.unit
|
|
212
|
-
#=> #<UnitMeasurements::Unit: km (kilometer, kilometers, kilometre, kilometres)>
|
|
192
|
+
length.quantity #=> 1
|
|
193
|
+
length.unit #=> #<UnitMeasurements::Unit: km (kilometer, kilometers, kilometre, kilometres)>
|
|
213
194
|
```
|
|
214
195
|
|
|
215
196
|
Unit object can be interrogated for a range of attributes:
|
|
216
197
|
|
|
217
198
|
```ruby
|
|
218
|
-
|
|
219
|
-
#=> #<Set: {"kilometer", "kilometers", "kilometre", "kilometres"}>
|
|
220
|
-
|
|
221
|
-
#=> 1000.0
|
|
199
|
+
# Alternative names for the unit.
|
|
200
|
+
length.unit.aliases #=> #<Set: {"kilometer", "kilometers", "kilometre", "kilometres"}>
|
|
201
|
+
# Conversion factor relative to primitive unit.
|
|
202
|
+
length.unit.conversion_factor #=> 1000.0
|
|
222
203
|
```
|
|
223
204
|
|
|
224
205
|
**See primitive unit of the unit group:**
|
|
225
206
|
|
|
226
207
|
```ruby
|
|
227
|
-
UnitMeasurements::Length.primitive
|
|
228
|
-
#=> #<UnitMeasurements::Unit: m (meter, meters, metre, metres)>
|
|
208
|
+
UnitMeasurements::Length.primitive #=> #<UnitMeasurements::Unit: m (meter, meters, metre, metres)>
|
|
229
209
|
```
|
|
230
210
|
|
|
231
211
|
**See all units of the unit group:**
|
|
@@ -238,8 +218,7 @@ UnitMeasurements::Length.units
|
|
|
238
218
|
**See names of all valid units of the unit group:**
|
|
239
219
|
|
|
240
220
|
```ruby
|
|
241
|
-
UnitMeasurements::Length.unit_names
|
|
242
|
-
#=> ["ft", "in", "m", "mi", "yd"]
|
|
221
|
+
UnitMeasurements::Length.unit_names #=> ["ft", "in", "m", "mi", "yd"]
|
|
243
222
|
```
|
|
244
223
|
|
|
245
224
|
**See all valid units of the unit group along with their aliases:**
|
|
@@ -252,8 +231,7 @@ UnitMeasurements::Length.unit_names_with_aliases
|
|
|
252
231
|
**See list of unit systems defined within the unit group:**
|
|
253
232
|
|
|
254
233
|
```ruby
|
|
255
|
-
UnitMeasurements::Length.systems
|
|
256
|
-
#=> ["metric", "imperial", "us_customary", "astronomical"]
|
|
234
|
+
UnitMeasurements::Length.systems #=> ["metric", "imperial", "us_customary", "astronomical"]
|
|
257
235
|
```
|
|
258
236
|
|
|
259
237
|
**See list of units within the unit system:**
|
|
@@ -273,30 +251,23 @@ You can use `#unit_for` or `#unit_for!` (aliased as `#[]`) methods to find units
|
|
|
273
251
|
within the unit group. `#unit_for!` method returns an error if a unit system is not defined within the unit group.
|
|
274
252
|
|
|
275
253
|
```ruby
|
|
276
|
-
UnitMeasurements::Length.unit_for("m")
|
|
277
|
-
|
|
278
|
-
UnitMeasurements::Length.unit_for("z")
|
|
279
|
-
#=> nil
|
|
280
|
-
UnitMeasurements::Length.unit_for!("z")
|
|
281
|
-
#=> Invalid unit: 'z'. (UnitMeasurements::UnitError)
|
|
254
|
+
UnitMeasurements::Length.unit_for("m") #=> #<UnitMeasurements::Unit: m (meter, meters, metre, metres)>
|
|
255
|
+
UnitMeasurements::Length.unit_for("z") #=> nil
|
|
256
|
+
UnitMeasurements::Length.unit_for!("z") #=> Invalid unit: 'z'. (UnitMeasurements::UnitError)
|
|
282
257
|
```
|
|
283
258
|
|
|
284
259
|
**Finding whether the unit is defined within the unit group:**
|
|
285
260
|
|
|
286
261
|
```ruby
|
|
287
|
-
UnitMeasurements::Length.defined?("m")
|
|
288
|
-
#=>
|
|
289
|
-
UnitMeasurements::Length.defined?("metre")
|
|
290
|
-
#=> false
|
|
262
|
+
UnitMeasurements::Length.defined?("m") #=> true
|
|
263
|
+
UnitMeasurements::Length.defined?("metre") #=> false
|
|
291
264
|
```
|
|
292
265
|
|
|
293
266
|
**Check if the unit is a valid unit or alias within the unit group:**
|
|
294
267
|
|
|
295
268
|
```ruby
|
|
296
|
-
UnitMeasurements::Length.unit_or_alias?("m")
|
|
297
|
-
#=> true
|
|
298
|
-
UnitMeasurements::Length.unit_or_alias?("metre")
|
|
299
|
-
#=> true
|
|
269
|
+
UnitMeasurements::Length.unit_or_alias?("m") #=> true
|
|
270
|
+
UnitMeasurements::Length.unit_or_alias?("metre") #=> true
|
|
300
271
|
```
|
|
301
272
|
|
|
302
273
|
**Clear cached data for the unit group:**
|
|
@@ -311,8 +282,7 @@ You have ability to compare the measurements with the same or different units wi
|
|
|
311
282
|
For example, comparing length with length will work, comparing a length with a area would fail.
|
|
312
283
|
|
|
313
284
|
```ruby
|
|
314
|
-
UnitMeasurements::Length.parse("1 km") != UnitMeasurements::Length.parse("1 m")
|
|
315
|
-
#=> true
|
|
285
|
+
UnitMeasurements::Length.parse("1 km") != UnitMeasurements::Length.parse("1 m") #=> true
|
|
316
286
|
```
|
|
317
287
|
|
|
318
288
|
You can check supported comparisons along with their examples
|
|
@@ -326,10 +296,8 @@ measurement by either other measurement with compatible unit or numeric value.
|
|
|
326
296
|
In cases of different units, the left hand side takes precedence.
|
|
327
297
|
|
|
328
298
|
```ruby
|
|
329
|
-
UnitMeasurements::Length.new(1, "km") + UnitMeasurements::Length.new(1, "m")
|
|
330
|
-
#=>
|
|
331
|
-
UnitMeasurements::Length.new(2, "km") * 2+2i
|
|
332
|
-
#=> 4+2i km
|
|
299
|
+
UnitMeasurements::Length.new(1, "km") + UnitMeasurements::Length.new(1, "m") #=> 1.001 km
|
|
300
|
+
UnitMeasurements::Length.new(2, "km") * 2+2i #=> 4+2i km
|
|
333
301
|
```
|
|
334
302
|
|
|
335
303
|
You can check supported arithmetic operations along with their examples
|
|
@@ -340,8 +308,7 @@ You can check supported arithmetic operations along with their examples
|
|
|
340
308
|
You can perform mathematical functions on the measurements.
|
|
341
309
|
|
|
342
310
|
```ruby
|
|
343
|
-
UnitMeasurements::Length.new(17.625, "m").round
|
|
344
|
-
# => 18 m
|
|
311
|
+
UnitMeasurements::Length.new(17.625, "m").round #=> 18 m
|
|
345
312
|
```
|
|
346
313
|
|
|
347
314
|
You can check supported mathematical functions along with their examples
|
|
@@ -353,8 +320,7 @@ You can convert measurement quantity directly to other numeric types viz.
|
|
|
353
320
|
`Integer`, `BigDecimal`, `Rational`, `Complex`, and `Float`.
|
|
354
321
|
|
|
355
322
|
```ruby
|
|
356
|
-
UnitMeasurements::Length.new(2.25567, "km").to_i
|
|
357
|
-
#=> 2 km
|
|
323
|
+
UnitMeasurements::Length.new(2.25567, "km").to_i #=> 2 km
|
|
358
324
|
```
|
|
359
325
|
|
|
360
326
|
You can check more about them along with their examples
|
|
@@ -500,9 +466,9 @@ This will enable the usage of these units as methods to instantiate and use meas
|
|
|
500
466
|
|
|
501
467
|
```ruby
|
|
502
468
|
# Initialize a measurement
|
|
503
|
-
1.m
|
|
504
|
-
5.feet
|
|
505
|
-
10.inches
|
|
469
|
+
1.m #=> 1 m
|
|
470
|
+
5.feet #=> 5 ft
|
|
471
|
+
10.inches #=> 10 in
|
|
506
472
|
|
|
507
473
|
# Usage
|
|
508
474
|
## Equality comparison
|
|
@@ -32,4 +32,8 @@ UnitMeasurements::Acceleration = UnitMeasurements.build do
|
|
|
32
32
|
system :centimetre_gram_second do
|
|
33
33
|
unit "Gal", value: "1e-2 m/s²", aliases: ["gal", "galileo"]
|
|
34
34
|
end
|
|
35
|
+
|
|
36
|
+
system :planck_units do
|
|
37
|
+
unit "aₚ", value: "5.5608e+51 m/s²", aliases: ["planck acceleration", "quantum acceleration"]
|
|
38
|
+
end
|
|
35
39
|
end
|
|
@@ -36,6 +36,10 @@ UnitMeasurements::Area = UnitMeasurements.build do
|
|
|
36
36
|
unit "ch² (US)", value: "404.6873 m²", aliases: ["ch^2 (US)", "sq ch (US)", "square chain (US)", "square chains (US)"]
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
system :planck_units do
|
|
40
|
+
unit "Aₚ", value: "2.6121e-70 m²", aliases: ["planck area", "quantum area"]
|
|
41
|
+
end
|
|
42
|
+
|
|
39
43
|
unit "bd", value: "0.00774192 m²", aliases: ["board", "boards"]
|
|
40
44
|
unit "ro", value: "1/4 ac", aliases: ["rood"]
|
|
41
45
|
end
|
|
@@ -26,4 +26,8 @@ UnitMeasurements::Density = UnitMeasurements.build do
|
|
|
26
26
|
unit "slug/ft³", value: "515.3788184 kg/m³", aliases: ["slug/ft^3", "slug per cubic foot", "slugs per cubic foot"]
|
|
27
27
|
unit "slug/in³", value: "890574.582782 kg/m³", aliases: ["slug/in^3", "slug per cubic inch", "slugs per cubic inch"]
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
system :planck_units do
|
|
31
|
+
unit "ρₚ", value: "5.1550e+96 kg/m³", aliases: ["planck density", "quantum density"]
|
|
32
|
+
end
|
|
29
33
|
end
|
|
@@ -15,4 +15,8 @@ UnitMeasurements::ElectricCharge = UnitMeasurements.build do
|
|
|
15
15
|
unit "abC", value: "10 C", aliases: ["abcoulomb", "abcoulombs"]
|
|
16
16
|
unit "statC", value: "3.335641e-10 C", aliases: ["statcoulomb", "statcoulombs"]
|
|
17
17
|
end
|
|
18
|
+
|
|
19
|
+
system :planck_units do
|
|
20
|
+
unit "qₚ", value: "1.875545956e-18 C", aliases: ["planck length", "quantum length"]
|
|
21
|
+
end
|
|
18
22
|
end
|
|
@@ -14,4 +14,8 @@ UnitMeasurements::ElectricCurrent = UnitMeasurements.build do
|
|
|
14
14
|
unit "abA", value: "10 A", aliases: ["abampere", "abamperes"]
|
|
15
15
|
unit "statA", value: "3.33564e-10 A", aliases: ["statampere", "statamperes"]
|
|
16
16
|
end
|
|
17
|
+
|
|
18
|
+
system :planck_units do
|
|
19
|
+
unit "Iₚ", value: "3.4789e+25 A", aliases: ["planck current", "quantum current"]
|
|
20
|
+
end
|
|
17
21
|
end
|
|
@@ -46,6 +46,10 @@ UnitMeasurements::Energy = UnitMeasurements.build do
|
|
|
46
46
|
unit "hp⋅h", value: "2.685e+13 erg", aliases: ["hp*h", "horsepower-hour"]
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
+
system :planck_units do
|
|
50
|
+
unit "Eₚ", value: "1.9561e+9 J", aliases: ["planck energy", "quantum energy"]
|
|
51
|
+
end
|
|
52
|
+
|
|
49
53
|
unit "Ry", value: "2.179872e-18 J", aliases: ["rydberg"]
|
|
50
54
|
unit "Ha", value: "4.359744e-18 J", aliases: ["hartree", "atomic unit of energy"]
|
|
51
55
|
unit "boe", value: "5.86152 GJ", aliases: ["barrel of oil equivalent", "barrels of oil equivalent"]
|
|
@@ -43,4 +43,8 @@ UnitMeasurements::Force = UnitMeasurements.build do
|
|
|
43
43
|
unit "(lb⋅ft)/s²", value: "0.138254954376 N", aliases: ["(lb*ft)/s^2", "pound foot per second squared"]
|
|
44
44
|
unit "(lb⋅in)/s²", value: "0.011521246198 N", aliases: ["(lb*in)/s^2", "pound inch per second squared"]
|
|
45
45
|
end
|
|
46
|
+
|
|
47
|
+
system :planck_units do
|
|
48
|
+
unit "Fₚ", value: "1.2103e+44 N", aliases: ["planck force", "quantum force"]
|
|
49
|
+
end
|
|
46
50
|
end
|
|
@@ -56,4 +56,8 @@ UnitMeasurements::Length = UnitMeasurements.build do
|
|
|
56
56
|
unit "lm", value: "30 ld", aliases: ["light-month", "light-months"]
|
|
57
57
|
unit "ly", value: "365.25 ld", aliases: ["light-year", "light-years"]
|
|
58
58
|
end
|
|
59
|
+
|
|
60
|
+
system :planck_units do
|
|
61
|
+
unit "lₚ", value: "1.616255e-35 m", aliases: ["planck length", "quantum length"]
|
|
62
|
+
end
|
|
59
63
|
end
|
|
@@ -49,5 +49,9 @@ UnitMeasurements::Power = UnitMeasurements.build do
|
|
|
49
49
|
unit "erg/s", value: "1e-7 W", aliases: ["erg per second", "ergs per second"]
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
system :planck_units do
|
|
53
|
+
unit "Pₚ", value: "3.6283e+52 W", aliases: ["planck power", "quantum power"]
|
|
54
|
+
end
|
|
55
|
+
|
|
52
56
|
unit "lusec", value: "133.3224 μW", aliases: ["lusecs"]
|
|
53
57
|
end
|
|
@@ -56,4 +56,8 @@ UnitMeasurements::Pressure = UnitMeasurements.build do
|
|
|
56
56
|
system :gravitational_metric do
|
|
57
57
|
unit "at", value: "98066.5 Pa", aliases: ["technical atmosphere", "technical atmospheres"]
|
|
58
58
|
end
|
|
59
|
+
|
|
60
|
+
system :planck_units do
|
|
61
|
+
unit "Pₚ", value: "4.63309e+113 Pa", aliases: ["planck pressure", "quantum pressure"]
|
|
62
|
+
end
|
|
59
63
|
end
|
|
@@ -12,4 +12,8 @@ UnitMeasurements::Temperature = UnitMeasurements.build do
|
|
|
12
12
|
system :english_engineering do
|
|
13
13
|
unit "°R", value: "5/9 K", aliases: ["R", "°Ra", "Ra", "rankine"]
|
|
14
14
|
end
|
|
15
|
+
|
|
16
|
+
system :planck_units do
|
|
17
|
+
unit "Tₚ", value: "1.416784e+32 K", aliases: ["planck temperature", "quantum temperature"]
|
|
18
|
+
end
|
|
15
19
|
end
|
|
@@ -13,6 +13,10 @@ UnitMeasurements::Time = UnitMeasurements.build do
|
|
|
13
13
|
unit "min", value: "60 s", aliases: ["minute", "minutes"]
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
system :planck_units do
|
|
17
|
+
unit "tₚ", value: "5.391247e-44 s", aliases: ["planck time", "quantum time"]
|
|
18
|
+
end
|
|
19
|
+
|
|
16
20
|
unit "wk", value: "7 d", aliases: ["week", "weeks"]
|
|
17
21
|
unit "mo", value: "30.4167 d", aliases: ["month", "months"]
|
|
18
22
|
unit "yr", value: "365 d", aliases: ["y", "year", "years"]
|
|
@@ -45,4 +45,8 @@ UnitMeasurements::Weight = UnitMeasurements.build do
|
|
|
45
45
|
system :foot_pound_second do
|
|
46
46
|
unit "slug", value: "32.17404856 lb", aliases: ["slugs"]
|
|
47
47
|
end
|
|
48
|
+
|
|
49
|
+
system :planck_units do
|
|
50
|
+
unit "mₚ", value: "2.176434e-8 kg", aliases: ["planck mass", "quantum mass"]
|
|
51
|
+
end
|
|
48
52
|
end
|
data/units.md
CHANGED
|
@@ -49,6 +49,7 @@ These units are defined in `UnitMeasurements::Length`.
|
|
|
49
49
|
| 30 | lmin | light-minute, light-minutes |
|
|
50
50
|
| 31 | cb (M) | CBL. (M), cable length (M) |
|
|
51
51
|
| 32 | cb (US) | CBL. (US), cable length (US) |
|
|
52
|
+
| 33 | lₚ | planck length, quantum length |
|
|
52
53
|
|
|
53
54
|
## 2. Weight or mass
|
|
54
55
|
|
|
@@ -78,6 +79,7 @@ These units are defined in `UnitMeasurements::Weight`.
|
|
|
78
79
|
| 20 | cwt | hundredweight, long hundredweight, imperial hundredweight |
|
|
79
80
|
| 21 | slug | slugs |
|
|
80
81
|
| 22 | cwt (US) | hundredweight (US), short hundredweight |
|
|
82
|
+
| 23 | mₚ | planck mass, quantum mass |
|
|
81
83
|
|
|
82
84
|
## 3. Time or duration
|
|
83
85
|
|
|
@@ -96,6 +98,7 @@ These units are defined in `UnitMeasurements::Time`.
|
|
|
96
98
|
| 9 | qtr | quarter, quarters |
|
|
97
99
|
| 10 | dec | decade, decades |
|
|
98
100
|
| 11 | cent | century, centuries |
|
|
101
|
+
| 12 | tₚ | planck time, quantum time |
|
|
99
102
|
|
|
100
103
|
## 4. Amount of substance
|
|
101
104
|
|
|
@@ -116,6 +119,7 @@ These units are defined in `UnitMeasurements::ElectricCurrent`.
|
|
|
116
119
|
| 2 | abA | abampere, abamperes |
|
|
117
120
|
| 3 | Bi | biot, biots |
|
|
118
121
|
| 4 | statA | statampere, statamperes |
|
|
122
|
+
| 5 | Iₚ | planck current, quantum current |
|
|
119
123
|
|
|
120
124
|
## 6. Luminous intensity
|
|
121
125
|
|
|
@@ -134,6 +138,7 @@ These units are defined in `UnitMeasurements::Temperature`.
|
|
|
134
138
|
|:--|:--|:--|
|
|
135
139
|
| _1_ | _K*_ | _kelvin, kelvins_ |
|
|
136
140
|
| 2 | °R | R, °Ra, Ra, rankine |
|
|
141
|
+
| 3 | Tₚ | planck temperature, quantum temperature |
|
|
137
142
|
|
|
138
143
|
## 8. Area
|
|
139
144
|
|
|
@@ -161,6 +166,7 @@ These units are defined in `UnitMeasurements::Area`.
|
|
|
161
166
|
| 18 | ft² (US) | ft^2 (US), sq ft (US), square foot (US), square feet (US) |
|
|
162
167
|
| 19 | mi² (US) | mi^2 (US), sq mi (US), square mile (US), square miles (US) |
|
|
163
168
|
| 20 | ch² (US) | ch^2 (US), sq ch (US), square chain (US), square chains (US) |
|
|
169
|
+
| 21 | Aₚ | planck area, quantum area |
|
|
164
170
|
|
|
165
171
|
## 9. Volume & capacity
|
|
166
172
|
|
|
@@ -203,6 +209,7 @@ These units are defined in `UnitMeasurements::Volume`.
|
|
|
203
209
|
| 33 | ac⋅ft | acre-foot, acre-feet |
|
|
204
210
|
| 34 | ac⋅in | acre-inch, acre-inches |
|
|
205
211
|
| 35 | cd-ft | cord-foot, cord-feet |
|
|
212
|
+
| 36 | Vₚ | planck volume, quantum volume |
|
|
206
213
|
|
|
207
214
|
## 10. Density
|
|
208
215
|
|
|
@@ -223,6 +230,7 @@ These units are defined in `UnitMeasurements::Density`.
|
|
|
223
230
|
| 11 | lb/gal | pound per gallon, pounds per gallon |
|
|
224
231
|
| 12 | slug/ft³ | slug/ft^3, slug per cubic foot, slugs per cubic foot |
|
|
225
232
|
| 13 | slug/in³ | slug/in^3, slug per cubic inch, slugs per cubic inch |
|
|
233
|
+
| 14 | ρₚ | planck density, quantum density |
|
|
226
234
|
|
|
227
235
|
## 11. Quantity
|
|
228
236
|
|
|
@@ -302,7 +310,8 @@ These units are defined in `UnitMeasurements::Force`.
|
|
|
302
310
|
| 14 | kipf | kip, klbf, kip-force |
|
|
303
311
|
| 15 | (lb⋅m)/s² | (lb*m)/s^2, pound meter per second squared, pound metre per second squared |
|
|
304
312
|
| 16 | (lb⋅ft)/s² | (lb*ft)/s^2, pound foot per second squared |
|
|
305
|
-
| 17 | (lb⋅in)/s² | (lb
|
|
313
|
+
| 17 | (lb⋅in)/s² | (lb\*in)/s^2, pound inch per second squared |
|
|
314
|
+
| 18 | Fₚ | planck force, quantum force |
|
|
306
315
|
|
|
307
316
|
## 16. Velocity or speed
|
|
308
317
|
|
|
@@ -343,6 +352,7 @@ These units are defined in `UnitMeasurements::Acceleration`.
|
|
|
343
352
|
| 10 | mpm/s | mi/(min⋅s), mile per minute per second, miles per minute per second |
|
|
344
353
|
| 11 | mph/s | mi/(h⋅s), mile per hour per second, miles per hour per second |
|
|
345
354
|
| 12 | Kn/s | knot per second, knots per second |
|
|
355
|
+
| 13 | aₚ | planck acceleration, quantum acceleration |
|
|
346
356
|
|
|
347
357
|
## 18. Angular velocity or rotational speed
|
|
348
358
|
|
|
@@ -396,6 +406,7 @@ These units are defined in `UnitMeasurements::ElectricCharge`.
|
|
|
396
406
|
| 3 | statC | statcoulomb, statcoulombs |
|
|
397
407
|
| 4 | Fr | franklin, franklins |
|
|
398
408
|
| 5 | Fd | faraday, faradays |
|
|
409
|
+
| 6 | qₚ | planck charge, quantum charge |
|
|
399
410
|
|
|
400
411
|
## 22. Electrical capacitance
|
|
401
412
|
|
|
@@ -541,6 +552,7 @@ These units are defined in `UnitMeasurements::Pressure`.
|
|
|
541
552
|
| 25 | kgf/m² | kgf/m^2, kilogram-force per square metre, kilogramme-force per square metre |
|
|
542
553
|
| 26 | kgf/mm² | kgf/mm^2, kilogram-force per square millimetre, kilogramme-force per square millimetre |
|
|
543
554
|
| 27 | kgf/dm² | kgf/dm^2, kilogram-force per square decimetre, kilogramme-force per square decimetre |
|
|
555
|
+
| 28 | Pₚ | planck pressure, quantum pressure |
|
|
544
556
|
|
|
545
557
|
## 34. Torque or moment of force
|
|
546
558
|
|
|
@@ -639,7 +651,8 @@ These units are defined in `UnitMeasurements::Power`.
|
|
|
639
651
|
| 22 | lusec | lusecs |
|
|
640
652
|
| 23 | atm⋅ft³/s | atm*ft^3/s, atmosphere-cubic foot per second |
|
|
641
653
|
| 24 | atm⋅ft³/min | atm*ft^3/min, atmosphere-cubic foot per minute |
|
|
642
|
-
| 25 | atm⋅ft³/h | atm
|
|
654
|
+
| 25 | atm⋅ft³/h | atm\*ft^3/h, atmosphere-cubic foot per hour |
|
|
655
|
+
| 26 | Pₚ | planck power, quantum power |
|
|
643
656
|
|
|
644
657
|
## 40. Energy
|
|
645
658
|
|
|
@@ -671,6 +684,7 @@ These units are defined in `UnitMeasurements::Energy`.
|
|
|
671
684
|
| 22 | in⋅lbf | in\*lbf, in⋅lb, in\*lb, inch-pound force |
|
|
672
685
|
| 23 | ft⋅pdl | ft*pdl, foot-poundal |
|
|
673
686
|
| 24 | gal⋅atm | gal*atm, gallon-atmosphere |
|
|
687
|
+
| 25 | Eₚ | planck energy, quantum energy |
|
|
674
688
|
|
|
675
689
|
## 41. Dynamic viscosity
|
|
676
690
|
|
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.
|
|
4
|
+
version: 5.16.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-12-
|
|
11
|
+
date: 2023-12-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|