unit_measurements 5.8.0 → 5.10.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 +26 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -8
- data/lib/unit_measurements/arithmetic.rb +4 -0
- data/lib/unit_measurements/base.rb +2 -0
- data/lib/unit_measurements/configuration.rb +1 -1
- data/lib/unit_measurements/errors/blank_quantity_error.rb +21 -0
- data/lib/unit_measurements/errors/blank_unit_error.rb +21 -0
- data/lib/unit_measurements/formatter.rb +16 -9
- data/lib/unit_measurements/math.rb +2 -2
- data/lib/unit_measurements/measurement.rb +6 -4
- data/lib/unit_measurements/unit_groups/energy.rb +32 -2
- data/lib/unit_measurements/unit_groups/force.rb +18 -2
- data/lib/unit_measurements/unit_groups/torque.rb +11 -0
- data/lib/unit_measurements/version.rb +1 -1
- data/units.md +55 -20
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 519b4112a693a9c722e1241381eafb095005e4cbdef9792662e339df52087abf
|
4
|
+
data.tar.gz: 34054c7ef9056fe40d25f698403f0585b805c7426710302b102e93709582090b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbfdf296b4fab0d7b2c5a7932939ca9cba3205d42f9709d72b070b98748b97cd68a4a29d10c9f086fbd9decf65f906a977458f902e70a04ba2ee019326062f5a
|
7
|
+
data.tar.gz: df52b1126595b98d905a9f9b86b9884dcddd4c06b3ac547ba8bbac0d2dc4108d35329b1a629d278bf4cadf2959d4923e27be14a08702d8b5fd911affc977a0db
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
## [5.10.0](https://github.com/shivam091/unit_measurements/compare/v5.9.0...v5.10.0) - 2023-11-09
|
2
|
+
|
3
|
+
### What's new
|
4
|
+
|
5
|
+
- Added new method `#to_fs` to format the measurement.
|
6
|
+
- Aliased arithmetic method `#**` to `#pow` and `#^`.
|
7
|
+
- Aliased arithmetic method `#-@` to `#inverse` and `#negate`.
|
8
|
+
- Added `UnitMeasurements::BlankQuantityError` error if tried to initialize the `Measurement` with a blank quantity.
|
9
|
+
- Added `UnitMeasurements::BlankUnitError` error if tried to initialize the `Measurement` with a blank unit.
|
10
|
+
|
11
|
+
### What's deprecated
|
12
|
+
|
13
|
+
- `#format` method in favour of `#to_fs`.
|
14
|
+
|
15
|
+
----------
|
16
|
+
|
17
|
+
## [5.9.0](https://github.com/shivam091/unit_measurements/compare/v5.8.0...v5.9.0) - 2023-11-08
|
18
|
+
|
19
|
+
### What's new
|
20
|
+
|
21
|
+
- Added new units of `force`.
|
22
|
+
- Added new units of `torque`.
|
23
|
+
- Added new units of `energy`.
|
24
|
+
|
25
|
+
----------
|
26
|
+
|
1
27
|
## [5.8.0](https://github.com/shivam091/unit_measurements/compare/v5.7.0...v5.8.0) - 2023-11-06
|
2
28
|
|
3
29
|
### What's new
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -95,6 +95,7 @@ UnitMeasurements::Length.new(1, "km")
|
|
95
95
|
|
96
96
|
This gem allows you to convert among units of same unit group. You can convert measurement to other unit using `#convert_to`
|
97
97
|
(aliased as `#to`, `#in`, and `#as`) or `#convert_to!` (aliased as `#to!`, `#in!`, and `#as!`) methods.
|
98
|
+
You can also chain call of `#convert_to` and `#convert_to!` methods.
|
98
99
|
|
99
100
|
These methods provide `use_cache` parameter which defaults to `false` to indicate whether the caching of conversion factors should happen.
|
100
101
|
|
@@ -119,13 +120,6 @@ UnitMeasurements::Length.new(1, "cm").convert_to("primitive")
|
|
119
120
|
#=> 0.01 m
|
120
121
|
```
|
121
122
|
|
122
|
-
You can also chain call of `#convert_to` and `#convert_to!` methods as:
|
123
|
-
|
124
|
-
```ruby
|
125
|
-
UnitMeasurements::Length.new(100, "m").convert_to("ft").convert_to!("in", use_cache: true)
|
126
|
-
#=> 3937.00787401574071916010498688 in
|
127
|
-
```
|
128
|
-
|
129
123
|
**Parse string without having to split out the quantity and source unit:**
|
130
124
|
|
131
125
|
This method provides `use_cache` parameter which defaults to `false` to indicate whether the caching of conversion factors should happen.
|
@@ -198,7 +192,7 @@ UnitMeasurements::Length.new(100, "m").to("in").to_fs("%.4<quantity>f %<unit>s")
|
|
198
192
|
You can check more about formatting along with their examples
|
199
193
|
[here](https://shivam091.github.io/unit_measurements/UnitMeasurements/Formatter.html).
|
200
194
|
|
201
|
-
**Extract the
|
195
|
+
**Extract the quantity and the unit from measurement:**
|
202
196
|
|
203
197
|
```ruby
|
204
198
|
length = UnitMeasurements::Length.new(1, "km")
|
@@ -208,6 +202,15 @@ length.unit
|
|
208
202
|
#=> #<UnitMeasurements::Unit: km (kilometer, kilometers, kilometre, kilometres)>
|
209
203
|
```
|
210
204
|
|
205
|
+
Unit object can be interrogated for a range of attributes:
|
206
|
+
|
207
|
+
```ruby
|
208
|
+
length.unit.aliases # Alternative names for the unit.
|
209
|
+
#=> #<Set: {"kilometer", "kilometers", "kilometre", "kilometres"}>
|
210
|
+
length.unit.conversion_factor # Conversion factor relative to primitive unit.
|
211
|
+
#=> 1000.0
|
212
|
+
```
|
213
|
+
|
211
214
|
**See primitive unit of the unit group:**
|
212
215
|
|
213
216
|
```ruby
|
@@ -134,6 +134,8 @@ module UnitMeasurements
|
|
134
134
|
def **(other)
|
135
135
|
arithmetic_operation(other, :**)
|
136
136
|
end
|
137
|
+
alias_method :pow, :**
|
138
|
+
alias_method :^, :**
|
137
139
|
|
138
140
|
# Negates the quantity of the measurement.
|
139
141
|
#
|
@@ -151,6 +153,8 @@ module UnitMeasurements
|
|
151
153
|
def -@
|
152
154
|
self.class.new(-self.quantity, self.unit)
|
153
155
|
end
|
156
|
+
alias_method :inverse, :-@
|
157
|
+
alias_method :negate, :-@
|
154
158
|
|
155
159
|
# Checks whether the quantity of the measurement is nonzero.
|
156
160
|
#
|
@@ -148,3 +148,5 @@ require "unit_measurements/errors/unit_error"
|
|
148
148
|
require "unit_measurements/errors/parse_error"
|
149
149
|
require "unit_measurements/errors/unit_already_defined_error"
|
150
150
|
require "unit_measurements/errors/primitive_unit_already_set_error"
|
151
|
+
require "unit_measurements/errors/blank_quantity_error"
|
152
|
+
require "unit_measurements/errors/blank_unit_error"
|
@@ -55,7 +55,7 @@ module UnitMeasurements
|
|
55
55
|
# @since 5.3.0
|
56
56
|
def use_cache=(use_cache)
|
57
57
|
unless [true, false].include?(use_cache)
|
58
|
-
raise
|
58
|
+
raise ArgumentError, "Configuration#use_cache= only accepts true or false, but received #{use_cache}"
|
59
59
|
end
|
60
60
|
|
61
61
|
@use_cache = use_cache
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
module UnitMeasurements
|
6
|
+
# The +UnitMeasurements::BlankQuantityError+ class represents an error that
|
7
|
+
# occurs when trying to initialize the +Measurement+ with a blank quantity.
|
8
|
+
#
|
9
|
+
# @see BaseError
|
10
|
+
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
|
11
|
+
# @since 5.10.0
|
12
|
+
class BlankQuantityError < BaseError
|
13
|
+
# Initializes a new +BlankQuantityError+ instance.
|
14
|
+
#
|
15
|
+
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
|
16
|
+
# @since 5.10.0
|
17
|
+
def initialize
|
18
|
+
super("Quantity cannot be blank.")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
module UnitMeasurements
|
6
|
+
# The +UnitMeasurements::BlankUnitError+ class represents an error that
|
7
|
+
# occurs when trying to initialize the +Measurement+ with a blank unit.
|
8
|
+
#
|
9
|
+
# @see BaseError
|
10
|
+
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
|
11
|
+
# @since 5.10.0
|
12
|
+
class BlankUnitError < BaseError
|
13
|
+
# Initializes a new +BlankUnitError+ instance.
|
14
|
+
#
|
15
|
+
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
|
16
|
+
# @since 5.10.0
|
17
|
+
def initialize
|
18
|
+
super("Unit cannot be blank.")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -18,19 +18,27 @@ module UnitMeasurements
|
|
18
18
|
# containing placeholders for +quantity+ and +unit+.
|
19
19
|
DEFAULT_FORMAT = "%.2<quantity>f %<unit>s".freeze
|
20
20
|
|
21
|
+
# @deprecated This method has been deprecated in favour of {#to_fs}.
|
22
|
+
#
|
23
|
+
# This method is no longer recommended for use. Please use {#to_fs}
|
24
|
+
# instead.
|
25
|
+
def format(format = nil)
|
26
|
+
warn "DEPRECATION WARNING: The `format` method is deprecated and will be removed in upcoming release. Please use `to_fs` instead."
|
27
|
+
to_fs(format)
|
28
|
+
end
|
29
|
+
|
21
30
|
# Formats measurement to certain formatted string specified by +format+.
|
22
|
-
# If +format+ is not specified, it uses
|
31
|
+
# If +format+ is not specified, it uses {DEFAULT_FORMAT} for formatting the
|
23
32
|
# measurement.
|
24
33
|
#
|
25
|
-
# The
|
26
|
-
# measurement. It uses format placeholders for +quantity+ and +unit+.
|
27
|
-
# custom format is provided, it will use the +DEFAULT_FORMAT+.
|
34
|
+
# The {#to_fs} method allows for customization of the output format of a
|
35
|
+
# measurement. It uses format placeholders for +quantity+ and +unit+.
|
28
36
|
#
|
29
37
|
# @example
|
30
|
-
# UnitMeasurements::Length.new(1, "m").to("in").
|
38
|
+
# UnitMeasurements::Length.new(1, "m").to("in").to_fs
|
31
39
|
# => "39.37 in"
|
32
40
|
#
|
33
|
-
# UnitMeasurements::Length.new(1, "m").to("in").
|
41
|
+
# UnitMeasurements::Length.new(1, "m").to("in").to_fs("%.4<quantity>f %<unit>s")
|
34
42
|
# => "39.3701 in"
|
35
43
|
#
|
36
44
|
# @param [String, optional] format
|
@@ -41,10 +49,9 @@ module UnitMeasurements
|
|
41
49
|
#
|
42
50
|
# @see DEFAULT_FORMAT
|
43
51
|
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
|
44
|
-
# @since
|
45
|
-
def
|
52
|
+
# @since 5.10.0
|
53
|
+
def to_fs(format = nil)
|
46
54
|
kwargs = {quantity: quantity, unit: unit.to_s}
|
47
|
-
|
48
55
|
(format || DEFAULT_FORMAT) % kwargs
|
49
56
|
end
|
50
57
|
end
|
@@ -64,7 +64,7 @@ module UnitMeasurements
|
|
64
64
|
#
|
65
65
|
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
|
66
66
|
# @since 1.6.0
|
67
|
-
def floor(ndigits =0)
|
67
|
+
def floor(ndigits = 0)
|
68
68
|
self.class.new(quantity.floor(ndigits), unit)
|
69
69
|
end
|
70
70
|
|
@@ -84,7 +84,7 @@ module UnitMeasurements
|
|
84
84
|
#
|
85
85
|
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
|
86
86
|
# @since 1.6.0
|
87
|
-
def ceil(ndigits =0)
|
87
|
+
def ceil(ndigits = 0)
|
88
88
|
self.class.new(quantity.ceil(ndigits), unit)
|
89
89
|
end
|
90
90
|
end
|
@@ -104,14 +104,16 @@ module UnitMeasurements
|
|
104
104
|
# @param [Numeric|String] quantity The quantity of the measurement.
|
105
105
|
# @param [String|Unit] unit The unit of the measurement.
|
106
106
|
#
|
107
|
-
# @raise [
|
107
|
+
# @raise [BlankQuantityError] If +quantity+ is blank.
|
108
|
+
# @raise [BlankUnitError] If +unit+ is blank.
|
108
109
|
#
|
109
|
-
# @see
|
110
|
+
# @see BlankQuantityError
|
111
|
+
# @see BlankUnitError
|
110
112
|
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
|
111
113
|
# @since 1.0.0
|
112
114
|
def initialize(quantity, unit)
|
113
|
-
raise
|
114
|
-
raise
|
115
|
+
raise BlankQuantityError if quantity.blank?
|
116
|
+
raise BlankUnitError if unit.blank?
|
115
117
|
|
116
118
|
@quantity = convert_quantity(quantity)
|
117
119
|
@unit = unit_from_unit_or_name!(unit)
|
@@ -10,6 +10,10 @@ UnitMeasurements::Energy = UnitMeasurements.build do
|
|
10
10
|
si_unit "cal", value: "4.1868 J", aliases: ["calorie", "calories"]
|
11
11
|
|
12
12
|
unit "eV", value: "1.602176634e-19 J", aliases: ["electronvolt", "electron volt", "electron-volt"]
|
13
|
+
|
14
|
+
unit "W⋅s", value: "1 J", aliases: ["W*s", "watt-second"]
|
15
|
+
unit "W⋅h", value: "3600 J", aliases: ["W*h", "watt-hour"]
|
16
|
+
unit "kW⋅h", value: "3.6e+6 J", aliases: ["kW*h", "kilowatt-hour"]
|
13
17
|
end
|
14
18
|
|
15
19
|
system :centimetre_gram_second do
|
@@ -17,11 +21,37 @@ UnitMeasurements::Energy = UnitMeasurements.build do
|
|
17
21
|
end
|
18
22
|
|
19
23
|
system :us_customary do
|
20
|
-
si_unit "
|
24
|
+
si_unit "BTU", value: "1055.05585262 J", aliases: ["Btu", "british thermal unit", "british thermal units"]
|
21
25
|
|
22
|
-
unit "thm", value: "100
|
26
|
+
unit "thm", value: "100 kBTU", aliases: ["therm", "therms"]
|
23
27
|
unit "quad", value: "1.05505585262e+18 J", aliases: ["quads"]
|
28
|
+
|
29
|
+
unit "ft⋅lbf", value: "1.3558179483314004 J", aliases: ["ft*lbf", "ft⋅lb", "ft*lb", "foot-pound force"]
|
30
|
+
unit "in⋅lbf", value: "0.1129848290276167 J", aliases: ["in*lbf", "in⋅lb", "in*lb", "inch-pound force"]
|
31
|
+
end
|
32
|
+
|
33
|
+
system :foot_pound_second do
|
34
|
+
unit "ft⋅pdl", value: "4.21401100938048e-2 J", aliases: ["ft*pdl", "foot-poundal"]
|
35
|
+
end
|
36
|
+
|
37
|
+
system :metre_tonne_second do
|
38
|
+
unit "th", value: "4.1868e+6 J", aliases: ["thermie", "thermies"]
|
39
|
+
end
|
40
|
+
|
41
|
+
system :gravitational_metric do
|
42
|
+
unit "kp⋅m", value: "9.80665 J", aliases: ["kpm", "kp*m", "kilopond-metre", "kilopond-meter"]
|
43
|
+
end
|
44
|
+
|
45
|
+
system :imperial do
|
46
|
+
unit "hp⋅h", value: "2.685e+13 erg", aliases: ["hp*h", "horsepower-hour"]
|
24
47
|
end
|
25
48
|
|
49
|
+
unit "Ry", value: "2.179872e-18 J", aliases: ["rydberg"]
|
50
|
+
unit "Ha", value: "4.359744e-18 J", aliases: ["hartree", "atomic unit of energy"]
|
51
|
+
unit "boe", value: "5.86152 GJ", aliases: ["barrel of oil equivalent", "barrels of oil equivalent"]
|
52
|
+
unit "tce", value: "29.3076 GJ", aliases: ["TCE", "tonne of coal equivalent", "tonnes of coal equivalent"]
|
53
|
+
unit "toe", value: "41.868 GJ", aliases: ["tonne of oil equivalent", "tonnes of oil equivalent"]
|
26
54
|
unit "foe", value: "1e+51 erg", aliases: ["bethe"]
|
55
|
+
unit "l⋅atm", value: "101.325 J", aliases: ["l*atm", "litre-atmosphere", "liter-atmosphere"]
|
56
|
+
unit "gal⋅atm", value: "460.63256925 J", aliases: ["gal*atm", "gallon-atmosphere"]
|
27
57
|
end
|
@@ -8,7 +8,10 @@ UnitMeasurements::Force = UnitMeasurements.build do
|
|
8
8
|
system :metric do
|
9
9
|
si_unit "N", aliases: ["newton", "newtons"]
|
10
10
|
|
11
|
-
unit "
|
11
|
+
unit "p", value: "0.00980665 N", aliases: ["pond", "ponds"]
|
12
|
+
unit "gf", value: "0.00980665 N", aliases: ["gram-force", "gramme-force"]
|
13
|
+
unit "kgf", value: "9.80665 N", aliases: ["kp", "gvf", "kilogram-force", "kilogramme-force"]
|
14
|
+
unit "mgvf", value: "9.80665 mN", aliases: ["gvtf", "gravet-force", "milligrave-force"]
|
12
15
|
end
|
13
16
|
|
14
17
|
system :centimetre_gram_second do
|
@@ -16,7 +19,8 @@ UnitMeasurements::Force = UnitMeasurements.build do
|
|
16
19
|
end
|
17
20
|
|
18
21
|
system :metre_tonne_second do
|
19
|
-
unit "
|
22
|
+
unit "sn", value: "1e+3 N", aliases: ["sthene", "sthenes", "sthène"]
|
23
|
+
unit "tf", value: "8896.443230521 N", aliases: ["metric ton-force", "tonne-force"]
|
20
24
|
end
|
21
25
|
|
22
26
|
system :english_engineering do
|
@@ -27,4 +31,16 @@ UnitMeasurements::Force = UnitMeasurements.build do
|
|
27
31
|
unit "pdl", value: "0.138254954376 N", aliases: ["poundal", "poundals"]
|
28
32
|
unit "ozf", value: "0.27801385095378125 N", aliases: ["ounce-force"]
|
29
33
|
end
|
34
|
+
|
35
|
+
system :us_customary do
|
36
|
+
unit "tnf", value: "2000 lbf", aliases: ["ton-force", "short ton-force"]
|
37
|
+
unit "kipf", value: "4.4482216152605e+3 N", aliases: ["kip", "klbf", "kip-force"]
|
38
|
+
end
|
39
|
+
|
40
|
+
system :imperial do
|
41
|
+
unit "LTf", value: "2240 lbf", aliases: ["long ton-force"]
|
42
|
+
unit "(lb⋅m)/s²", value: "0.45359237 N", aliases: ["(lb*m)/s^2", "pound meter per second squared", "pound metre per second squared"]
|
43
|
+
unit "(lb⋅ft)/s²", value: "0.138254954376 N", aliases: ["(lb*ft)/s^2", "pound foot per second squared"]
|
44
|
+
unit "(lb⋅in)/s²", value: "0.011521246198 N", aliases: ["(lb*in)/s^2", "pound inch per second squared"]
|
45
|
+
end
|
30
46
|
end
|
@@ -8,11 +8,22 @@ UnitMeasurements::Torque = UnitMeasurements.build do
|
|
8
8
|
system :metric do
|
9
9
|
si_unit "N·m", aliases: ["N*m", "newton meter", "newton metre"]
|
10
10
|
|
11
|
+
unit "N·cm", value: "0.01 N·m", aliases: ["N*cm", "newton centimeter", "newton centimetre"]
|
12
|
+
unit "N·mm", value: "0.001 N·m", aliases: ["N*mm", "newton millimeter", "newton millimetre"]
|
13
|
+
|
14
|
+
unit "gf·m", value: "9.80665e-3 N·m", aliases: ["gf*m", "gram-force meter", "gramme-force metre"]
|
15
|
+
unit "gf·cm", value: "9.80665e-5 N·m", aliases: ["gf*cm", "gram-force centimeter", "gramme-force centimetre"]
|
16
|
+
unit "gf·mm", value: "9.80665e-6 N·m", aliases: ["gf*mm", "gram-force millimeter", "gramme-force millimetre"]
|
17
|
+
|
11
18
|
unit "kgf·m", value: "9.80665 N·m", aliases: ["kgf*m", "Kilogram-force meter", "kilogramme-force metre"]
|
19
|
+
unit "kgf·cm", value: "0.0980665 N·m", aliases: ["kgf*cm", "Kilogram-force centimeter", "kilogramme-force centimetre"]
|
20
|
+
unit "kgf·mm", value: "0.00980665 N·m", aliases: ["kgf*mm", "Kilogram-force millimeter", "kilogramme-force millimetre"]
|
12
21
|
end
|
13
22
|
|
14
23
|
system :centimetre_gram_second do
|
24
|
+
unit "dyn·m", value: "1e-5 N·m", aliases: ["dyn*m", "dyne meter", "dyne metre"]
|
15
25
|
unit "dyn·cm", value: "1e-7 N·m", aliases: ["dyn*cm", "dyne centimeter", "dyne centimetre"]
|
26
|
+
unit "dyn·mm", value: "1e-8 N·m", aliases: ["dyn*mm", "dyne millimeter", "dyne millimetre"]
|
16
27
|
end
|
17
28
|
|
18
29
|
system :foot_pound_second do
|
data/units.md
CHANGED
@@ -287,12 +287,22 @@ These units are defined in `UnitMeasurements::Force`.
|
|
287
287
|
| # | Name | Aliases |
|
288
288
|
|:--|:--|:--|
|
289
289
|
| _1_ | _N*_ | _newton, newtons_ |
|
290
|
-
| 2 |
|
291
|
-
| 3 |
|
292
|
-
| 4 |
|
293
|
-
| 5 |
|
294
|
-
| 6 |
|
295
|
-
| 7 |
|
290
|
+
| 2 | p | pond, ponds |
|
291
|
+
| 3 | gf | gram-force, gramme-force |
|
292
|
+
| 4 | tf | metric ton-force, tonne-force |
|
293
|
+
| 5 | sn | sthene, sthenes, sthène |
|
294
|
+
| 6 | dyn | dyne, dynes |
|
295
|
+
| 7 | kgf | kp, gvf, kilogram-force, kilogramme-force |
|
296
|
+
| 8 | ozf | ounce-force |
|
297
|
+
| 9 | lbf | pound-force |
|
298
|
+
| 10 | pdl | poundal, poundals |
|
299
|
+
| 11 | tnf | ton-force, short ton-force |
|
300
|
+
| 12 | LTf | long ton-force |
|
301
|
+
| 13 | mgvf | gvtf, gravet-force, milligrave-force |
|
302
|
+
| 14 | kipf | kip, klbf, kip-force |
|
303
|
+
| 15 | (lb⋅m)/s² | (lb*m)/s^2, pound meter per second squared, pound metre per second squared |
|
304
|
+
| 16 | (lb⋅ft)/s² | (lb*ft)/s^2, pound foot per second squared |
|
305
|
+
| 17 | (lb⋅in)/s² | (lb*in)/s^2, pound inch per second squared |
|
296
306
|
|
297
307
|
## 16. Velocity or speed
|
298
308
|
|
@@ -539,13 +549,22 @@ These units are defined in `UnitMeasurements::Torque`.
|
|
539
549
|
| # | Name | Aliases |
|
540
550
|
|:--|:--|:--|
|
541
551
|
| _1_ | _N·m*_ | _N*m, newton meter, newton metre_ |
|
542
|
-
| 2 |
|
543
|
-
| 3 |
|
544
|
-
| 4 |
|
545
|
-
| 5 |
|
546
|
-
| 6 |
|
547
|
-
| 7 |
|
548
|
-
| 8 |
|
552
|
+
| 2 | N·cm | N*cm, newton centimeter, newton centimetre |
|
553
|
+
| 3 | N·mm | N*mm, newton millimeter, newton millimetre |
|
554
|
+
| 4 | gf·m | gf*m, gram-force meter, gramme-force metre |
|
555
|
+
| 5 | gf·cm | gf*cm, gram-force centimeter, gramme-force centimetre |
|
556
|
+
| 6 | gf·mm | gf*mm, gram-force millimeter, gramme-force millimetre |
|
557
|
+
| 7 | kgf·m | kgf*m, Kilogram-force meter, kilogramme-force metre |
|
558
|
+
| 8 | kgf·cm | kgf*cm, Kilogram-force centimeter, kilogramme-force centimetre |
|
559
|
+
| 9 | kgf·mm | kgf*mm, Kilogram-force millimeter, kilogramme-force millimetre |
|
560
|
+
| 10 | dyn·m | dyn*m, dyne meter, dyne metre |
|
561
|
+
| 11 | dyn·cm | dyn*cm, dyne centimeter, dyne centimetre |
|
562
|
+
| 12 | dyn·mm | dyn*mm, dyne millimeter, dyne millimetre |
|
563
|
+
| 13 | pdl⋅ft | pdl*ft, poundal foot, foot-poundal |
|
564
|
+
| 14 | ozf·in | oz⋅in, ozf\*in, oz\*in, ounce-force inch, ounce-inch |
|
565
|
+
| 15 | ozf·ft | oz⋅ft, ozf\*ft, oz\*ft, ounce-force foot, ounce-foot |
|
566
|
+
| 16 | lbf⋅in | lb⋅in, lbf\*in, lb\*in, pound-force inch, pound-inch |
|
567
|
+
| 17 | lbf⋅ft | lb⋅ft, lbf\*ft, lb\*ft, pound-force foot, pound-foot |
|
549
568
|
|
550
569
|
## 35. Luminous flux
|
551
570
|
|
@@ -629,13 +648,29 @@ These units are defined in `UnitMeasurements::Energy`.
|
|
629
648
|
| # | Name | Aliases |
|
630
649
|
|:--|:--|:--|
|
631
650
|
| _1_ | _J*_ | _joule, joules_ |
|
632
|
-
| 2 |
|
633
|
-
| 3 |
|
634
|
-
| 4 |
|
635
|
-
| 5 |
|
636
|
-
| 6 |
|
637
|
-
| 7 |
|
638
|
-
| 8 |
|
651
|
+
| 2 | eV | electronvolt, electron volt, electron-volt |
|
652
|
+
| 3 | th | thermie, thermies |
|
653
|
+
| 4 | Ry | rydberg |
|
654
|
+
| 5 | Ha | hartree, atomic unit of energy |
|
655
|
+
| 6 | boe | barrel of oil equivalent, barrels of oil equivalent |
|
656
|
+
| 7 | toe | tonne of oil equivalent, tonnes of oil equivalent |
|
657
|
+
| 8 | tce | TCE, tonne of coal equivalent, tonnes of coal equivalent |
|
658
|
+
| 9 | cal | calorie, calories |
|
659
|
+
| 10 | erg | ergs |
|
660
|
+
| 11 | BTU | Btu, british thermal unit, british thermal units |
|
661
|
+
| 12 | thm | therm, therms |
|
662
|
+
| 13 | W⋅s | W*s, watt-second |
|
663
|
+
| 14 | W⋅h | W*h, watt-hour |
|
664
|
+
| 15 | kp⋅m | kpm, kp*m, kilopond-metre, kilopond-meter |
|
665
|
+
| 16 | hp⋅h | hp*h, horsepower-hour |
|
666
|
+
| 17 | kW⋅h | kW*h, kilowatt-hour |
|
667
|
+
| 18 | foe | bethe |
|
668
|
+
| 19 | quad | quads |
|
669
|
+
| 20 | l⋅atm | l*atm, litre-atmosphere, liter-atmosphere |
|
670
|
+
| 21 | ft⋅lbf | ft\*lbf, ft⋅lb, ft\*lb, foot-pound force |
|
671
|
+
| 22 | in⋅lbf | in\*lbf, in⋅lb, in\*lb, inch-pound force |
|
672
|
+
| 23 | ft⋅pdl | ft*pdl, foot-poundal |
|
673
|
+
| 24 | gal⋅atm | gal*atm, gallon-atmosphere |
|
639
674
|
|
640
675
|
## 41. Dynamic viscosity
|
641
676
|
|
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.10.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-11-
|
11
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -111,6 +111,8 @@ files:
|
|
111
111
|
- lib/unit_measurements/comparison.rb
|
112
112
|
- lib/unit_measurements/configuration.rb
|
113
113
|
- lib/unit_measurements/conversion.rb
|
114
|
+
- lib/unit_measurements/errors/blank_quantity_error.rb
|
115
|
+
- lib/unit_measurements/errors/blank_unit_error.rb
|
114
116
|
- lib/unit_measurements/errors/parse_error.rb
|
115
117
|
- lib/unit_measurements/errors/primitive_unit_already_set_error.rb
|
116
118
|
- lib/unit_measurements/errors/unit_already_defined_error.rb
|