unit_measurements_us_complete 5.17.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 +7 -0
- data/.github/workflows/main.yml +31 -0
- data/.github/workflows/pages.yml +31 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.yardopts +2 -0
- data/CHANGELOG.md +645 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +56 -0
- data/LICENSE.md +21 -0
- data/README.md +511 -0
- data/Rakefile +10 -0
- data/lib/unit_measurements/arithmetic.rb +225 -0
- data/lib/unit_measurements/base.rb +177 -0
- data/lib/unit_measurements/cache.rb +173 -0
- data/lib/unit_measurements/comparison.rb +64 -0
- data/lib/unit_measurements/configuration.rb +64 -0
- data/lib/unit_measurements/conversion.rb +92 -0
- 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/errors/missing_primitive_unit_error.rb +24 -0
- data/lib/unit_measurements/errors/parse_error.rb +37 -0
- data/lib/unit_measurements/errors/primitive_unit_already_set_error.rb +22 -0
- data/lib/unit_measurements/errors/unit_already_defined_error.rb +37 -0
- data/lib/unit_measurements/errors/unit_error.rb +36 -0
- data/lib/unit_measurements/extras/conversion_methods.rb +87 -0
- data/lib/unit_measurements/extras/numeric_methods.rb +85 -0
- data/lib/unit_measurements/formatter.rb +58 -0
- data/lib/unit_measurements/math.rb +120 -0
- data/lib/unit_measurements/measurement.rb +539 -0
- data/lib/unit_measurements/normalizer.rb +155 -0
- data/lib/unit_measurements/parser.rb +220 -0
- data/lib/unit_measurements/unit.rb +243 -0
- data/lib/unit_measurements/unit_group.rb +297 -0
- data/lib/unit_measurements/unit_group_builder.rb +224 -0
- data/lib/unit_measurements/unit_groups/acceleration.rb +36 -0
- data/lib/unit_measurements/unit_groups/all.rb +56 -0
- data/lib/unit_measurements/unit_groups/amount_of_substance.rb +13 -0
- data/lib/unit_measurements/unit_groups/angular_acceleration.rb +14 -0
- data/lib/unit_measurements/unit_groups/angular_velocity.rb +25 -0
- data/lib/unit_measurements/unit_groups/area.rb +49 -0
- data/lib/unit_measurements/unit_groups/catalytic_activity.rb +13 -0
- data/lib/unit_measurements/unit_groups/density.rb +33 -0
- data/lib/unit_measurements/unit_groups/dynamic_viscosity.rb +22 -0
- data/lib/unit_measurements/unit_groups/electric_charge.rb +20 -0
- data/lib/unit_measurements/unit_groups/electric_conductance.rb +15 -0
- data/lib/unit_measurements/unit_groups/electric_current.rb +19 -0
- data/lib/unit_measurements/unit_groups/electric_dipole_moment.rb +13 -0
- data/lib/unit_measurements/unit_groups/electric_potential.rb +17 -0
- data/lib/unit_measurements/unit_groups/electric_quadrupole_moment.rb +14 -0
- data/lib/unit_measurements/unit_groups/electrical_capacitance.rb +15 -0
- data/lib/unit_measurements/unit_groups/electrical_elastance.rb +13 -0
- data/lib/unit_measurements/unit_groups/electrical_inductance.rb +15 -0
- data/lib/unit_measurements/unit_groups/electrical_resistance.rb +16 -0
- data/lib/unit_measurements/unit_groups/energy.rb +58 -0
- data/lib/unit_measurements/unit_groups/force.rb +47 -0
- data/lib/unit_measurements/unit_groups/frequency.rb +16 -0
- data/lib/unit_measurements/unit_groups/illuminance.rb +18 -0
- data/lib/unit_measurements/unit_groups/information_entropy.rb +15 -0
- data/lib/unit_measurements/unit_groups/kinetic_viscosity.rb +18 -0
- data/lib/unit_measurements/unit_groups/length.rb +67 -0
- data/lib/unit_measurements/unit_groups/luminance.rb +21 -0
- data/lib/unit_measurements/unit_groups/luminous_flux.rb +11 -0
- data/lib/unit_measurements/unit_groups/luminous_intensity.rb +13 -0
- data/lib/unit_measurements/unit_groups/magnetic_field.rb +13 -0
- data/lib/unit_measurements/unit_groups/magnetic_flux.rb +15 -0
- data/lib/unit_measurements/unit_groups/magnetic_induction.rb +13 -0
- data/lib/unit_measurements/unit_groups/magnetomotive_force.rb +13 -0
- data/lib/unit_measurements/unit_groups/mass_flow_rate.rb +49 -0
- data/lib/unit_measurements/unit_groups/plane_angle.rb +30 -0
- data/lib/unit_measurements/unit_groups/power.rb +54 -0
- data/lib/unit_measurements/unit_groups/pressure.rb +60 -0
- data/lib/unit_measurements/unit_groups/quantity.rb +14 -0
- data/lib/unit_measurements/unit_groups/radiation_absorbed_dose.rb +14 -0
- data/lib/unit_measurements/unit_groups/radiation_equivalent_dose.rb +13 -0
- data/lib/unit_measurements/unit_groups/radiation_exposure.rb +15 -0
- data/lib/unit_measurements/unit_groups/radioactivity.rb +14 -0
- data/lib/unit_measurements/unit_groups/solid_angle.rb +18 -0
- data/lib/unit_measurements/unit_groups/sound_level.rb +13 -0
- data/lib/unit_measurements/unit_groups/temperature.rb +19 -0
- data/lib/unit_measurements/unit_groups/time.rb +29 -0
- data/lib/unit_measurements/unit_groups/torque.rb +40 -0
- data/lib/unit_measurements/unit_groups/velocity.rb +37 -0
- data/lib/unit_measurements/unit_groups/volume.rb +67 -0
- data/lib/unit_measurements/unit_groups/volumetric_flow_rate.rb +35 -0
- data/lib/unit_measurements/unit_groups/weight.rb +55 -0
- data/lib/unit_measurements/version.rb +8 -0
- data/lib/unit_measurements.rb +7 -0
- data/unit_measurements.gemspec +43 -0
- data/units.md +843 -0
- metadata +216 -0
data/CHANGELOG.md
ADDED
@@ -0,0 +1,645 @@
|
|
1
|
+
## [5.18.0](https://github.com/shivam091/unit_measurements/compare/v5.17.0...v5.18.0) - 2023-12-16
|
2
|
+
|
3
|
+
### What's new
|
4
|
+
|
5
|
+
- Added unit group for `mass flow rate` units.
|
6
|
+
- Added unit group for `volumetric flow rate` units.
|
7
|
+
|
8
|
+
----------
|
9
|
+
|
10
|
+
## [5.17.0](https://github.com/shivam091/unit_measurements/compare/v5.16.0...v5.17.0) - 2023-12-15
|
11
|
+
|
12
|
+
### What's new
|
13
|
+
|
14
|
+
- Added new units `qr`, `U`, and `z` in `length`.
|
15
|
+
- Added new units `qr`, `fir`, and `us_qr` in `weight`.
|
16
|
+
- Added new units `dun`, `sec`, and `twp` in `area`.
|
17
|
+
- Added new units `st`, `fir`, and `pot` in `volume`.
|
18
|
+
|
19
|
+
### What's changed
|
20
|
+
|
21
|
+
- Changed implementation of `#units_for!` to raise error if the unit system is not defined
|
22
|
+
within the unit group.
|
23
|
+
- Changed symbol of `barleycorn` length unit.
|
24
|
+
|
25
|
+
----------
|
26
|
+
|
27
|
+
## [5.16.0](https://github.com/shivam091/unit_measurements/compare/v5.15.0...v5.16.0) - 2023-12-13
|
28
|
+
|
29
|
+
### What's new
|
30
|
+
|
31
|
+
- Added planck units and their conversions.
|
32
|
+
|
33
|
+
----------
|
34
|
+
|
35
|
+
## [5.15.0](https://github.com/shivam091/unit_measurements/compare/v5.14.0...v5.15.0) - 2023-12-11
|
36
|
+
|
37
|
+
### What's new
|
38
|
+
|
39
|
+
- Added `.define_conversion_methods` method to define conversion helper methods for units.
|
40
|
+
|
41
|
+
----------
|
42
|
+
|
43
|
+
## [5.14.0](https://github.com/shivam091/unit_measurements/compare/v5.13.0...v5.14.0) - 2023-11-29
|
44
|
+
|
45
|
+
### What's new
|
46
|
+
|
47
|
+
- Added `.define_numeric_methods` method to define numeric extension methods for units.
|
48
|
+
|
49
|
+
----------
|
50
|
+
|
51
|
+
## [5.13.0](https://github.com/shivam091/unit_measurements/compare/v5.12.0...v5.13.0) - 2023-11-27
|
52
|
+
|
53
|
+
### What's new
|
54
|
+
|
55
|
+
- Added `Measurement#to_primitive` to convert the measurement to the primitive unit.
|
56
|
+
- Added `#cbrt` method to calculate cube root of the measurement quantity.
|
57
|
+
- Added `#sqrt` method to calculate square root of the measurement quantity.
|
58
|
+
- Aliased `#to_primitive` method as `#in_primitive` and `#as_primitive`.
|
59
|
+
|
60
|
+
----------
|
61
|
+
|
62
|
+
## [5.12.0](https://github.com/shivam091/unit_measurements/compare/v5.11.1...v5.12.0) - 2023-11-25
|
63
|
+
|
64
|
+
### What's new
|
65
|
+
|
66
|
+
- Added `MissingPrimitiveUnitError` error if user tries to convert measurement to
|
67
|
+
the primitive unit but it's not set for the unit group.
|
68
|
+
- Aliased `#+` method as `#add`.
|
69
|
+
- Aliased `#-` method as `#subtract`.
|
70
|
+
- Aliased `#*` method as `#times` and `#multiply`.
|
71
|
+
- Aliased `#/` method as `#divide`.
|
72
|
+
|
73
|
+
----------
|
74
|
+
|
75
|
+
## [5.11.1](https://github.com/shivam091/unit_measurements/compare/v5.11.0...v5.11.1) - 2023-11-16
|
76
|
+
|
77
|
+
### What's changed
|
78
|
+
|
79
|
+
- Moved `BaseError` to base file for removing uninitialized constant error in reverse dependencies viz.
|
80
|
+
[unit_measurements-rails](https://rubygems.org/gems/unit_measurements-rails) and
|
81
|
+
[composite_unit_measurements](https://rubygems.org/gems/composite_unit_measurements).
|
82
|
+
|
83
|
+
----------
|
84
|
+
|
85
|
+
## [5.11.0](https://github.com/shivam091/unit_measurements/compare/v5.10.0...v5.11.0) - 2023-11-11
|
86
|
+
|
87
|
+
### What's new
|
88
|
+
|
89
|
+
- Added `#systems` method to return unit systems within the unit group.
|
90
|
+
- Added `#ratio` method to calculate the ratio between two units.
|
91
|
+
|
92
|
+
----------
|
93
|
+
|
94
|
+
## [5.10.0](https://github.com/shivam091/unit_measurements/compare/v5.9.0...v5.10.0) - 2023-11-09
|
95
|
+
|
96
|
+
### What's new
|
97
|
+
|
98
|
+
- Added new method `#to_fs` to format the measurement.
|
99
|
+
- Aliased arithmetic method `#**` to `#pow` and `#^`.
|
100
|
+
- Aliased arithmetic method `#-@` to `#inverse` and `#negate`.
|
101
|
+
- Added `UnitMeasurements::BlankQuantityError` error if tried to initialize the `Measurement` with a blank quantity.
|
102
|
+
- Added `UnitMeasurements::BlankUnitError` error if tried to initialize the `Measurement` with a blank unit.
|
103
|
+
|
104
|
+
### What's deprecated
|
105
|
+
|
106
|
+
- `#format` method in favour of `#to_fs`.
|
107
|
+
|
108
|
+
----------
|
109
|
+
|
110
|
+
## [5.9.0](https://github.com/shivam091/unit_measurements/compare/v5.8.0...v5.9.0) - 2023-11-08
|
111
|
+
|
112
|
+
### What's new
|
113
|
+
|
114
|
+
- Added new units of `force`.
|
115
|
+
- Added new units of `torque`.
|
116
|
+
- Added new units of `energy`.
|
117
|
+
|
118
|
+
----------
|
119
|
+
|
120
|
+
## [5.8.0](https://github.com/shivam091/unit_measurements/compare/v5.7.0...v5.8.0) - 2023-11-06
|
121
|
+
|
122
|
+
### What's new
|
123
|
+
|
124
|
+
- Added new units of `pressure`.
|
125
|
+
- Added new units of `power`.
|
126
|
+
|
127
|
+
----------
|
128
|
+
|
129
|
+
## [5.7.0](https://github.com/shivam091/unit_measurements/compare/v5.6.1...v5.7.0) - 2023-11-04
|
130
|
+
|
131
|
+
### What's new
|
132
|
+
|
133
|
+
- Added new units `λ`, `cd`, and `cd-ft` in `volume`.
|
134
|
+
- Added new units `tn`, `LT`, `hyl`, `cwt`, and `cwt (US)` in `weight`.
|
135
|
+
- Added new units `μ`, `cb`, `b.c.`, `S`, `ls`, `lmin`, `lh`, `ld`, `lw`, `lm`, `ly` in `length`.
|
136
|
+
- Added new units `tr`, `cyc`, `sign`, `octant`, `sextant`, and `quadrant` in `plane angle`.
|
137
|
+
|
138
|
+
### What's removed
|
139
|
+
|
140
|
+
- Removed wrong plural aliases from units of `frequency` and `magnetic induction`.
|
141
|
+
|
142
|
+
----------
|
143
|
+
|
144
|
+
## [5.6.1](https://github.com/shivam091/unit_measurements/compare/v5.6.0...v5.6.1) - 2023-11-03
|
145
|
+
|
146
|
+
### What's removed
|
147
|
+
|
148
|
+
- Removed uneeded aliases from units.
|
149
|
+
- Removed test cases of all unit conversions other than primitive unit.
|
150
|
+
|
151
|
+
----------
|
152
|
+
|
153
|
+
## [5.6.0](https://github.com/shivam091/unit_measurements/compare/v5.5.0...v5.6.0) - 2023-10-31
|
154
|
+
|
155
|
+
### What's new
|
156
|
+
|
157
|
+
- Added new units `ftm³`, `pk`, `gt`, `bsh`, `min`, `bkt`, `hhd`, `fls`, `dspn`, `fldr`, `bdft`, `ac⋅ft`, `ac⋅in` in volume.
|
158
|
+
- Added new units `oz/ft³`, `oz/in³`, `oz/gal`, `lb/ft³`, `lb/in³`, `lb/gal`, `slug/ft³`, `slug/in³` in density.
|
159
|
+
|
160
|
+
----------
|
161
|
+
|
162
|
+
## [5.5.0](https://github.com/shivam091/unit_measurements/compare/v5.4.1...v5.5.0) - 2023-10-29
|
163
|
+
|
164
|
+
### What's new
|
165
|
+
|
166
|
+
- Added new units `ipm/s`, `iph/s`, `mi/s²`, `mpm/s`, `mph/s`, `fpm/s`, `fph/s`, `Gal` in acceleration.
|
167
|
+
- Added new units `mi/s`, `mi/min`, `mi/h`, and `fur/ftn` in velocity.
|
168
|
+
- Added new units `lnk²`, `ac`, `ft²`, `mi²`, `ch²`, `bd`, and `ro` in area.
|
169
|
+
|
170
|
+
### What's updated
|
171
|
+
|
172
|
+
- Changed unit name `rod²` to `rd²` along with its aliases.
|
173
|
+
|
174
|
+
----------
|
175
|
+
|
176
|
+
## [5.4.1](https://github.com/shivam091/unit_measurements/compare/v5.4.0...v5.4.1) - 2023-10-28
|
177
|
+
|
178
|
+
### What's updated
|
179
|
+
|
180
|
+
- Updated unit systems and aliases of unit groups.
|
181
|
+
- Added alternative names for unit groups in unit reference file.
|
182
|
+
|
183
|
+
----------
|
184
|
+
|
185
|
+
## [5.4.0](https://github.com/shivam091/unit_measurements/compare/v5.3.0...v5.4.0) - 2023-10-27
|
186
|
+
|
187
|
+
### What's new
|
188
|
+
|
189
|
+
- Added new units `Å`, `lnk`, `lea`, `hh`, `nl`, and `sft` in length.
|
190
|
+
- Added new units `N`, `s`, `drt`, and `lbt` in weight.
|
191
|
+
|
192
|
+
----------
|
193
|
+
|
194
|
+
## [5.3.0](https://github.com/shivam091/unit_measurements/compare/v5.2.0...v5.3.0) - 2023-10-24
|
195
|
+
|
196
|
+
### What's new
|
197
|
+
|
198
|
+
- Added ability set globally configurable options for **`unit_measurements`**.
|
199
|
+
|
200
|
+
### What's improved
|
201
|
+
|
202
|
+
- Code coverage improvements.
|
203
|
+
|
204
|
+
----------
|
205
|
+
|
206
|
+
## [5.2.0](https://github.com/shivam091/unit_measurements/compare/v5.1.1...v5.2.0) - 2023-10-22
|
207
|
+
|
208
|
+
### What's new
|
209
|
+
|
210
|
+
- Added ability to set name of the cache file for the unit group.
|
211
|
+
- Added support for caching conversion factors between units of the unit group.
|
212
|
+
|
213
|
+
----------
|
214
|
+
|
215
|
+
## [5.1.1](https://github.com/shivam091/unit_measurements/compare/v5.1.0...v5.1.1) - 2023-10-20
|
216
|
+
|
217
|
+
### What's updated
|
218
|
+
|
219
|
+
- Updated readme and documentation.
|
220
|
+
- Updated documentation hosting link to `https://shivam091.github.io/unit_measurements`.
|
221
|
+
|
222
|
+
----------
|
223
|
+
|
224
|
+
## [5.1.0](https://github.com/shivam091/unit_measurements/compare/v5.0.0...v5.1.0) - 2023-10-19
|
225
|
+
|
226
|
+
### What's new
|
227
|
+
|
228
|
+
- Added new methods (`**`, `-@`, `nonzero?`, `zero?`, `positive?`, `negative?`,
|
229
|
+
`finite?`, and `infinite?`) to perform arithmetic operations.
|
230
|
+
- Added new alias `scale` for `**` arithmetic method.
|
231
|
+
|
232
|
+
### What's updated
|
233
|
+
|
234
|
+
- Updated readme and documentation.
|
235
|
+
- Updated documentation hosting link to `https://rubydoc.info/gems/unit_measurements`.
|
236
|
+
|
237
|
+
----------
|
238
|
+
|
239
|
+
## [5.0.0](https://github.com/shivam091/unit_measurements/compare/v4.12.0...v5.0.0) - 2023-10-18
|
240
|
+
|
241
|
+
### What's new
|
242
|
+
|
243
|
+
- Added support to add binary SI prefixes for the unit.
|
244
|
+
- Added support to convert the measurement to a `primitive` unit of the unit group.
|
245
|
+
- Added methods `UnitGroup#units_for` and `UnitGroup#units_for!` to find units within
|
246
|
+
the specified unit system.
|
247
|
+
|
248
|
+
----------
|
249
|
+
|
250
|
+
## [4.12.0](https://github.com/shivam091/unit_measurements/compare/v4.11.0...v4.12.0) - 2023-10-16
|
251
|
+
|
252
|
+
### What's new
|
253
|
+
|
254
|
+
- Added new units in `area` (are, barn, hectare, acre, square chain, square furlong, square rod) unit group.
|
255
|
+
- Added new units in `volume` (cup, quart, gill, pint, gallon, barrel, teaspoon, tablespoon, fluid ounce) unit group.
|
256
|
+
|
257
|
+
----------
|
258
|
+
|
259
|
+
## [4.11.0](https://github.com/shivam091/unit_measurements/compare/v4.10.0...v4.11.0) - 2023-10-15
|
260
|
+
|
261
|
+
### What's new
|
262
|
+
|
263
|
+
- Added new units in `length` (ch, th, ftm, fur, nmi, rod, au, pc) unit group.
|
264
|
+
- Added new units in `weight` (ct, Da, lb, st, oz, gr, ozt, dwt, dr, slug) unit group.
|
265
|
+
|
266
|
+
----------
|
267
|
+
|
268
|
+
## [4.10.0](https://github.com/shivam091/unit_measurements/compare/v4.9.0...v4.10.0) - 2023-10-14
|
269
|
+
|
270
|
+
### What's new
|
271
|
+
|
272
|
+
- Added documentation for all modules, classes, and methods.
|
273
|
+
- Updated readme and added workflow for publishing documentation using `yardoc`.
|
274
|
+
|
275
|
+
----------
|
276
|
+
|
277
|
+
## [4.9.0](https://github.com/shivam091/unit_measurements/compare/v4.8.0...v4.9.0) - 2023-10-13
|
278
|
+
|
279
|
+
### What's new
|
280
|
+
|
281
|
+
- Added unit group for `information entropy` units.
|
282
|
+
|
283
|
+
----------
|
284
|
+
|
285
|
+
## [4.8.0](https://github.com/shivam091/unit_measurements/compare/v4.7.0...v4.8.0) - 2023-10-12
|
286
|
+
|
287
|
+
### What's new
|
288
|
+
|
289
|
+
- Added unit group for `radiation exposure` units.
|
290
|
+
- Added unit group for `radiation absorbed dose` units.
|
291
|
+
- Added unit group for `radiation equivalent dose` units.
|
292
|
+
|
293
|
+
----------
|
294
|
+
|
295
|
+
## [4.7.0](https://github.com/shivam091/unit_measurements/compare/v4.6.0...v4.7.0) - 2023-10-11
|
296
|
+
|
297
|
+
### What's new
|
298
|
+
|
299
|
+
- Added unit group for `magnetomotive force` units.
|
300
|
+
- Added unit group for `radioactivity` units.
|
301
|
+
|
302
|
+
----------
|
303
|
+
|
304
|
+
## [4.6.0](https://github.com/shivam091/unit_measurements/compare/v4.5.0...v4.6.0) - 2023-10-10
|
305
|
+
|
306
|
+
### What's new
|
307
|
+
|
308
|
+
- Added unit group for `dynamic viscosity` units.
|
309
|
+
- Added unit group for `kinetic viscosity` units.
|
310
|
+
|
311
|
+
----------
|
312
|
+
|
313
|
+
## [4.5.0](https://github.com/shivam091/unit_measurements/compare/v4.4.0...v4.5.0) - 2023-10-09
|
314
|
+
|
315
|
+
### What's new
|
316
|
+
|
317
|
+
- Added unit group for `energy` units.
|
318
|
+
- Added unit group for `power` units.
|
319
|
+
|
320
|
+
----------
|
321
|
+
|
322
|
+
## [4.4.0](https://github.com/shivam091/unit_measurements/compare/v4.3.0...v4.4.0) - 2023-10-08
|
323
|
+
|
324
|
+
### What's new
|
325
|
+
|
326
|
+
- Added unit group for `luminance` units.
|
327
|
+
- Added unit group for `frequency` units.
|
328
|
+
|
329
|
+
----------
|
330
|
+
|
331
|
+
## [4.3.0](https://github.com/shivam091/unit_measurements/compare/v4.2.0...v4.3.0) - 2023-10-07
|
332
|
+
|
333
|
+
### What's new
|
334
|
+
|
335
|
+
- Added unit group for `luminous flux` units.
|
336
|
+
- Added unit group for `illuminance` units.
|
337
|
+
|
338
|
+
----------
|
339
|
+
|
340
|
+
## [4.2.0](https://github.com/shivam091/unit_measurements/compare/v4.1.0...v4.2.0) - 2023-10-06
|
341
|
+
|
342
|
+
### What's new
|
343
|
+
|
344
|
+
- Added unit group for `pressure` units.
|
345
|
+
- Added unit group for `torque` units.
|
346
|
+
|
347
|
+
----------
|
348
|
+
|
349
|
+
## [4.1.0](https://github.com/shivam091/unit_measurements/compare/v4.0.0...v4.1.0) - 2023-10-05
|
350
|
+
|
351
|
+
### What's new
|
352
|
+
|
353
|
+
- Added unit group for `catalytic activity` units.
|
354
|
+
- Added unit group for `electric dipole moment` units.
|
355
|
+
- Added unit group for `electric quadrupole moment` units.
|
356
|
+
|
357
|
+
----------
|
358
|
+
|
359
|
+
## [4.0.0](https://github.com/shivam091/unit_measurements/compare/v3.8.0...v4.0.0) - 2023-10-04
|
360
|
+
|
361
|
+
### What's new
|
362
|
+
|
363
|
+
- Added support to set `primitive` unit for each unit group.
|
364
|
+
- Added support to set `system` in `Unit` metadata.
|
365
|
+
- Added `UnitMeasurements::PrimitiveUnitAlreadySetError` error if `primitive` unit is defined more than one time in the unit group.
|
366
|
+
|
367
|
+
### What's changed
|
368
|
+
|
369
|
+
- Renamed `Voltage` unit group class to `ElectricPotential`.
|
370
|
+
- Renamed `Conductance` unit group class to `ElectricConductance`.
|
371
|
+
- Renamed `Resistance` unit group class to `ElectricalResistance`.
|
372
|
+
- Renamed `Elastance` unit group class to `ElectricalElastance`.
|
373
|
+
- Renamed `Capacitance` unit group class to `ElectricalCapacitance`.
|
374
|
+
- Renamed `Inductance` unit group class to `ElectricalInductance`.
|
375
|
+
|
376
|
+
### What's removed
|
377
|
+
|
378
|
+
- Removed support to build `UnitSystem` instances for each system within the unit group.
|
379
|
+
- Removed support to set `primitive` unit for each unit system within the unit group.
|
380
|
+
|
381
|
+
----------
|
382
|
+
|
383
|
+
## [3.8.0](https://github.com/shivam091/unit_measurements/compare/v3.7.0...v3.8.0) - 2023-10-03
|
384
|
+
|
385
|
+
### What's new
|
386
|
+
|
387
|
+
- Added unit group for `magnetic field` units.
|
388
|
+
- Added unit group for `inductance` units.
|
389
|
+
|
390
|
+
----------
|
391
|
+
|
392
|
+
## [3.7.0](https://github.com/shivam091/unit_measurements/compare/v3.6.0...v3.7.0) - 2023-10-02
|
393
|
+
|
394
|
+
### What's new
|
395
|
+
|
396
|
+
- Added unit group for `magnetic flux` units.
|
397
|
+
- Added unit group for `magnetic induction` units
|
398
|
+
|
399
|
+
----------
|
400
|
+
|
401
|
+
## [3.6.0](https://github.com/shivam091/unit_measurements/compare/v3.5.0...v3.6.0) - 2023-10-01
|
402
|
+
|
403
|
+
### What's new
|
404
|
+
|
405
|
+
- Added unit group for `resistance` units.
|
406
|
+
- Added unit group for `conductance` units.
|
407
|
+
|
408
|
+
----------
|
409
|
+
|
410
|
+
## [3.5.0](https://github.com/shivam091/unit_measurements/compare/v3.4.1...v3.5.0) - 2023-09-30
|
411
|
+
|
412
|
+
### What's new
|
413
|
+
|
414
|
+
- Added unit group for `capacitance` units.
|
415
|
+
- Added unit group for `elastance` units.
|
416
|
+
|
417
|
+
----------
|
418
|
+
|
419
|
+
## [3.4.1](https://github.com/shivam091/unit_measurements/compare/v3.4.0...v3.4.1) - 2023-09-29
|
420
|
+
|
421
|
+
### What's changed
|
422
|
+
|
423
|
+
- Updated usage examples in readme.
|
424
|
+
|
425
|
+
### What's removed
|
426
|
+
|
427
|
+
- Removed overridden `Measurement.name` method.
|
428
|
+
|
429
|
+
----------
|
430
|
+
|
431
|
+
## [3.4.0](https://github.com/shivam091/unit_measurements/compare/v3.3.0...v3.4.0) - 2023-09-28
|
432
|
+
|
433
|
+
### What's new
|
434
|
+
|
435
|
+
- Added ability to group units by `unit system`.
|
436
|
+
- Added ability to set `primitive` unit for each unit system.
|
437
|
+
- Added method `primitive?` to check whether the unit is primitive or not.
|
438
|
+
- Added method `system_for` to find unit system by name.
|
439
|
+
|
440
|
+
### What's changed
|
441
|
+
|
442
|
+
- Grouped units in system and set primitive unit for those systems.
|
443
|
+
|
444
|
+
----------
|
445
|
+
|
446
|
+
## [3.3.0](https://github.com/shivam091/unit_measurements/compare/v3.2.0...v3.3.0) - 2023-09-28
|
447
|
+
|
448
|
+
### What's new
|
449
|
+
|
450
|
+
- Added unit group for `electric charge` units.
|
451
|
+
- Added unit group for `angular velocity` units.
|
452
|
+
|
453
|
+
----------
|
454
|
+
|
455
|
+
## [3.2.0](https://github.com/shivam091/unit_measurements/compare/v3.1.0...v3.2.0) - 2023-09-27
|
456
|
+
|
457
|
+
### What's new
|
458
|
+
|
459
|
+
- Added unit group for `acceleration` units.
|
460
|
+
- Added unit group for `angular acceleration` units.
|
461
|
+
|
462
|
+
----------
|
463
|
+
|
464
|
+
## [3.1.0](https://github.com/shivam091/unit_measurements/compare/v3.0.0...v3.1.0) - 2023-09-26
|
465
|
+
|
466
|
+
### What's new
|
467
|
+
|
468
|
+
- Added unit group for `voltage` units.
|
469
|
+
- Added unit group for `velocity` units.
|
470
|
+
|
471
|
+
----------
|
472
|
+
|
473
|
+
## [3.0.0](https://github.com/shivam091/unit_measurements/compare/v2.6.2...v3.0.0) - 2023-09-25
|
474
|
+
|
475
|
+
### What's new
|
476
|
+
|
477
|
+
- Added method `Measurement.name` to get humanized name of the unit group.
|
478
|
+
- Raised `BaseError` in `Measurement.unit_group`.
|
479
|
+
- Added aliases `in`, `as`, `in!`, `as` for `convert_to` and `convert_to!` methods.
|
480
|
+
|
481
|
+
### What's changed
|
482
|
+
|
483
|
+
- Moved LICENSE to markdown file.
|
484
|
+
- Replaced `$LOAD_PATH` by shorthand `$:`
|
485
|
+
- Replaced `base` method by `unit`.
|
486
|
+
|
487
|
+
----------
|
488
|
+
|
489
|
+
## [2.6.2](https://github.com/shivam091/unit_measurements/compare/v2.6.1...v2.6.2) - 2023-09-25
|
490
|
+
|
491
|
+
### What's changed
|
492
|
+
|
493
|
+
- Replaced `String` by `Symbol` in unit names and symbols.
|
494
|
+
|
495
|
+
----------
|
496
|
+
|
497
|
+
## [2.6.1](https://github.com/shivam091/unit_measurements/compare/v2.6.0...v2.6.1) - 2023-09-24
|
498
|
+
|
499
|
+
### What's changed
|
500
|
+
|
501
|
+
- Replaced `Symbol` by `String` in unit names and symbols.
|
502
|
+
|
503
|
+
----------
|
504
|
+
|
505
|
+
## [2.6.0](https://github.com/shivam091/unit_measurements/compare/v2.5.0...v2.6.0) - 2023-09-24
|
506
|
+
|
507
|
+
### What's new
|
508
|
+
|
509
|
+
- Added unit group for `force` units.
|
510
|
+
- Added unit group for `solid angle` units.
|
511
|
+
|
512
|
+
----------
|
513
|
+
|
514
|
+
## [2.5.0](https://github.com/shivam091/unit_measurements/compare/v2.4.0...v2.5.0) - 2023-09-23
|
515
|
+
|
516
|
+
### What's new
|
517
|
+
|
518
|
+
- Added unit group for `sound level` units.
|
519
|
+
- Added unit group for `plane angle` units.
|
520
|
+
|
521
|
+
----------
|
522
|
+
|
523
|
+
## [2.4.0](https://github.com/shivam091/unit_measurements/compare/v2.3.0...v2.4.0) - 2023-09-23
|
524
|
+
|
525
|
+
### What's new
|
526
|
+
|
527
|
+
- Added unit group for `density` units.
|
528
|
+
- Added unit group for `quantity` units.
|
529
|
+
|
530
|
+
----------
|
531
|
+
|
532
|
+
## [2.3.0](https://github.com/shivam091/unit_measurements/compare/v2.2.0...v2.3.0) - 2023-09-22
|
533
|
+
|
534
|
+
### What's new
|
535
|
+
|
536
|
+
- Added unit group for `area` units.
|
537
|
+
- Added unit group for `volume` units.
|
538
|
+
|
539
|
+
----------
|
540
|
+
|
541
|
+
## [2.2.0](https://github.com/shivam091/unit_measurements/compare/v2.1.0...v2.2.0) - 2023-09-21
|
542
|
+
|
543
|
+
### What's new
|
544
|
+
|
545
|
+
- Added unit group for `electric current` units.
|
546
|
+
- Added unit group for `luminous intensity` units.
|
547
|
+
- Added unit group for `temperature` units.
|
548
|
+
|
549
|
+
----------
|
550
|
+
|
551
|
+
## [2.1.0](https://github.com/shivam091/unit_measurements/compare/v1.7.0...v2.1.0) - 2023-09-20
|
552
|
+
|
553
|
+
### What's new
|
554
|
+
|
555
|
+
- Added unit group for `time` units.
|
556
|
+
- Added unit group for `amount of substance` units.
|
557
|
+
|
558
|
+
----------
|
559
|
+
|
560
|
+
## [1.7.0](https://github.com/shivam091/unit_measurements/compare/v1.6.0...v1.7.0) - 2023-09-20
|
561
|
+
|
562
|
+
### What's new
|
563
|
+
|
564
|
+
- Added support to convert the measurements to other numeric types viz.,
|
565
|
+
`Integer`, `BigDecimal`, `Rational`, `Complex`, and `Float`.
|
566
|
+
|
567
|
+
----------
|
568
|
+
|
569
|
+
## [1.6.0](https://github.com/shivam091/unit_measurements/compare/v1.5.1...v1.6.0) - 2023-09-19
|
570
|
+
|
571
|
+
### What's new
|
572
|
+
|
573
|
+
- Added support to perform mathematical operations on the measurements.
|
574
|
+
|
575
|
+
----------
|
576
|
+
|
577
|
+
## [1.5.1](https://github.com/shivam091/unit_measurements/compare/v1.5.0...v1.5.1) - 2023-09-18
|
578
|
+
|
579
|
+
### What's updated
|
580
|
+
|
581
|
+
- Added extra blank line between method code and last code statement (considered as return).
|
582
|
+
|
583
|
+
----------
|
584
|
+
|
585
|
+
## [1.5.0](https://github.com/shivam091/unit_measurements/compare/v1.4.0...v1.5.0) - 2023-09-18
|
586
|
+
|
587
|
+
### What's fixed
|
588
|
+
|
589
|
+
- Fixed precision in `Measurement#quantity` method.
|
590
|
+
|
591
|
+
----------
|
592
|
+
|
593
|
+
## [1.4.0](https://github.com/shivam091/unit_measurements/compare/v1.3.0...v1.4.0) - 2023-09-17
|
594
|
+
|
595
|
+
### What's new
|
596
|
+
|
597
|
+
- Added ability to perform `arithmetic` operations of measurements.
|
598
|
+
|
599
|
+
----------
|
600
|
+
|
601
|
+
## [1.3.0](https://github.com/shivam091/unit_measurements/compare/v1.2.0...v1.3.0) - 2023-09-16
|
602
|
+
|
603
|
+
### What's new
|
604
|
+
|
605
|
+
- Added ability to compare two measurements of the same unit group.
|
606
|
+
|
607
|
+
----------
|
608
|
+
|
609
|
+
## [1.2.0](https://github.com/shivam091/unit_measurements/compare/v1.1.0...v1.2.0) - 2023-09-15
|
610
|
+
|
611
|
+
### What's new
|
612
|
+
|
613
|
+
- Added support to specify unit value as an `array` of number and unit.
|
614
|
+
|
615
|
+
----------
|
616
|
+
|
617
|
+
## [1.1.0](https://github.com/shivam091/unit_measurements/compare/v1.0.0...v1.1.0) - 2023-09-14
|
618
|
+
|
619
|
+
### What's new
|
620
|
+
|
621
|
+
- Added `#format` method to format quantity of the measurement.
|
622
|
+
|
623
|
+
----------
|
624
|
+
|
625
|
+
## [1.0.0](https://github.com/shivam091/unit_measurements/compare/v0.1.0...v1.0.0) - 2023-09-14
|
626
|
+
|
627
|
+
### What's new
|
628
|
+
|
629
|
+
- Added support to build unit groups.
|
630
|
+
- Added unit group for `length` units.
|
631
|
+
- Added unit group for `weight` units.
|
632
|
+
- Added support to build `si` units.
|
633
|
+
- Added support to parse `Complex`, `Rational`, `Scientific` numbers, and `ratios`.
|
634
|
+
- Added support to convert quantity between two units using `#convert_to`, `#convert_to!`, and `#parse` methods.
|
635
|
+
- Added normalizer to normalize special characters used in numbers.
|
636
|
+
|
637
|
+
----------
|
638
|
+
|
639
|
+
## 0.1.0 - 2023-09-13
|
640
|
+
|
641
|
+
### Initial release
|
642
|
+
|
643
|
+
-----------
|
644
|
+
|
645
|
+
### Unreleased
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
unit_measurements (5.17.0)
|
5
|
+
activesupport (~> 7.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (7.0.8)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 1.6, < 2)
|
13
|
+
minitest (>= 5.1)
|
14
|
+
tzinfo (~> 2.0)
|
15
|
+
byebug (11.1.3)
|
16
|
+
concurrent-ruby (1.2.2)
|
17
|
+
diff-lcs (1.5.0)
|
18
|
+
docile (1.4.0)
|
19
|
+
i18n (1.14.1)
|
20
|
+
concurrent-ruby (~> 1.0)
|
21
|
+
minitest (5.20.0)
|
22
|
+
rake (13.0.6)
|
23
|
+
rspec (3.12.0)
|
24
|
+
rspec-core (~> 3.12.0)
|
25
|
+
rspec-expectations (~> 3.12.0)
|
26
|
+
rspec-mocks (~> 3.12.0)
|
27
|
+
rspec-core (3.12.2)
|
28
|
+
rspec-support (~> 3.12.0)
|
29
|
+
rspec-expectations (3.12.3)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.12.0)
|
32
|
+
rspec-mocks (3.12.6)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.12.0)
|
35
|
+
rspec-support (3.12.1)
|
36
|
+
simplecov (0.22.0)
|
37
|
+
docile (~> 1.1)
|
38
|
+
simplecov-html (~> 0.11)
|
39
|
+
simplecov_json_formatter (~> 0.1)
|
40
|
+
simplecov-html (0.12.3)
|
41
|
+
simplecov_json_formatter (0.1.4)
|
42
|
+
tzinfo (2.0.6)
|
43
|
+
concurrent-ruby (~> 1.0)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
x86_64-linux
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
byebug (~> 11)
|
50
|
+
rake (~> 13.0)
|
51
|
+
rspec (~> 3.0)
|
52
|
+
simplecov (~> 0.21, >= 0.21.2)
|
53
|
+
unit_measurements!
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
2.4.10
|