unit_measurements 4.2.0 → 4.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3a74eda6588ea67b8d469b7bb51f933e8df36cfe3e1879b50656c0629111413
4
- data.tar.gz: dfb6588696254c70afa9dc0aeb40c71f7b913df3cdb61b5e4c546be7438d924d
3
+ metadata.gz: 97b1f40dcd946ddde0dcfc746431ac768147585a1aa5a100a356b8c59f9da235
4
+ data.tar.gz: 8f1453cb23ff2ae5140d8cfb0b72d4b8dba70025c5ac797c3bdc4a88d5c1020b
5
5
  SHA512:
6
- metadata.gz: ab088d43d155a1251eec52df0e96a272f3b3edf3835401490fc568490de96c344893e6716f92dfa40a5f07610e857759743d1a5e1e43b8ae3063884e85539408
7
- data.tar.gz: 47dadbb4085c0f549df05d79bd7c2baf02b3439488ad3eaf7353c420cd44fb39b269e2fb0df9a4916f5087145decf20d3f6f306e926c5e756f87049ee022db29
6
+ metadata.gz: 12121950bb3682117d3d81851de85022a3409043ad9206f58f7a8c5f7caeaebc677175917b874013644cb68df505f3197f5ac21154a2a6708733ace96c3cfc11
7
+ data.tar.gz: df30c4e06c04adc8085c1fd902249d4bc1ba934017b8b1565617c543cbdf16c22c0904a21bc9f7c9644d1467753534e86025f50c7c6d66d5e20d059491947c41
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## [4.4.0](https://github.com/shivam091/unit_measurements/compare/v4.3.0...v4.4.0) - 2023-10-08
2
+
3
+ ### What's new
4
+
5
+ - Added unit group for `luminance` units.
6
+ - Added unit group for `frequency` units.
7
+
8
+ ----------
9
+
10
+ ## [4.3.0](https://github.com/shivam091/unit_measurements/compare/v4.2.0...v4.3.0) - 2023-10-07
11
+
12
+ ### What's new
13
+
14
+ - Added unit group for `luminous flux` units.
15
+ - Added unit group for `illuminance` units.
16
+
17
+ ----------
18
+
1
19
  ## [4.2.0](https://github.com/shivam091/unit_measurements/compare/v4.1.0...v4.2.0) - 2023-10-06
2
20
 
3
21
  ### What's new
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unit_measurements (4.2.0)
4
+ unit_measurements (4.4.0)
5
5
  activesupport (~> 7.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -424,10 +424,10 @@ and set primitive unit for each unit group using `primitive` method.
424
424
 
425
425
  ```ruby
426
426
  UnitMeasurements::Time = UnitMeasurements.build do
427
- # Set primitive unit for the unit group.
427
+ # Set primitive unit for the unit group (optional).
428
428
  primitive "s"
429
429
 
430
- # Group units by the unit system.
430
+ # Group units by the unit system (optional).
431
431
  system :metric do
432
432
  # Add a SI unit to the unit group.
433
433
  si_unit "s", aliases: ["second", "seconds"]
@@ -37,6 +37,10 @@ require_relative "magnetic_field"
37
37
  require_relative "catalytic_activity"
38
38
  require_relative "pressure"
39
39
  require_relative "torque"
40
+ require_relative "luminous_flux"
41
+ require_relative "illuminance"
42
+ require_relative "luminance"
43
+ require_relative "frequency"
40
44
 
41
45
  ## Other units
42
46
 
@@ -0,0 +1,16 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::Frequency = UnitMeasurements.build do
6
+ primitive "Hz"
7
+
8
+ system :metric do
9
+ si_unit "Hz", aliases: ["hertz", "hertzes"]
10
+
11
+ unit "rad/s", value: [Rational(1, (2 * Math::PI)), "Hz"], aliases: ["rad·s⁻¹", "radian per second", "radians per second"]
12
+ end
13
+
14
+ unit "deg/s", value: [Rational(1, 360), "Hz"], aliases: ["°/s", "deg·s⁻¹", "degree per second", "degrees per second"]
15
+ unit "rev/s", value: [1, "Hz"], aliases: ["rps", "rev·s⁻¹", "revolution per second", "revolutions per second"]
16
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::Illuminance = UnitMeasurements.build do
6
+ primitive "lx"
7
+
8
+ system :metric do
9
+ si_unit "lx", aliases: ["lux", "lm/m²", "lm/m^2", "lm·m⁻²", "lumen per square metre", "lumen per square meter"]
10
+ end
11
+
12
+ system :centimetre_gram_second do
13
+ unit "ph", value: "10000 lx", aliases: ["phot", "phots", "lm/cm²", "lm/cm^2", "lm·cm⁻²", "lumen per square centimetre", "lumen per square centimeter"]
14
+ end
15
+
16
+ system :us_customary do
17
+ unit "fc", value: "10.763910417 lx", aliases: ["footcandle", "lm/ft²", "lm/ft^2", "lm·ft⁻²", "lumen per square foot"]
18
+ end
19
+
20
+ unit "nx", value: "1 mlx", aliases: ["nox"]
21
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::Luminance = UnitMeasurements.build do
6
+ primitive "cd/m²"
7
+
8
+ system :metric do
9
+ unit "cd/m²", aliases: ["cd/m^2", "cd·m⁻²", "candela per square metre", "candelas per square metre", "candela per square meter", "candelas per square meter"]
10
+ end
11
+
12
+ system :us_customary do
13
+ unit "cd/in²", value: "1550.0031 cd/m²", aliases: ["cd/in^2", "cd·in⁻²", "candela per square inch", "candelas per square inch"]
14
+ unit "cd/ft²", value: "10.763910417 cd/m²", aliases: ["cd/ft^2", "cd·ft⁻²", "candela per square foot", "candelas per square foot"]
15
+ unit "fL", value: [Rational(1, Math::PI), "cd/ft²"], aliases: ["ft-L", "foot lambert", "foot-lambert"]
16
+ end
17
+
18
+ system :centimetre_gram_second do
19
+ unit "L", value: [Rational(10000, Math::PI), "cd/m²"], aliases: ["lambert", "lamberts"]
20
+ unit "sb", value: "10000 cd/m²", aliases: ["stlib"]
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::LuminousFlux = UnitMeasurements.build do
6
+ primitive "lm"
7
+
8
+ system :metric do
9
+ si_unit "lm", aliases: ["lumen", "lumens"]
10
+ end
11
+ end
@@ -3,5 +3,5 @@
3
3
  # -*- warn_indent: true -*-
4
4
 
5
5
  module UnitMeasurements
6
- VERSION = "4.2.0"
6
+ VERSION = "4.4.0"
7
7
  end
data/units.md CHANGED
@@ -4,7 +4,7 @@ As there are lots of units bundled with `unit_measurements`, we recommend you to
4
4
  bundled units before converting your measurements.
5
5
 
6
6
  **Notes:**
7
- 1. Unit names suffixed with `*` support all [SI prefixes](README.md#si-units-support).
7
+ 1. Unit names suffixed with `*` support all [SI prefixes](README.md#support-for-si-decimal-prefixes).
8
8
  2. Primitive unit of the unit group is in _emphasis typeface_.
9
9
 
10
10
  ## 1. Length/Distance
@@ -411,3 +411,46 @@ These units are defined in `UnitMeasurements::Torque`.
411
411
  | 6 | ozf·ft | oz⋅ft, ozf\*ft, oz\*ft, ounce-force foot, ounce-foot |
412
412
  | 7 | lbf⋅in | lb⋅in, lbf\*in, lb\*in, pound-force inch, pound-inch |
413
413
  | 8 | lbf⋅ft | lb⋅ft, lbf\*ft, lb\*ft, pound-force foot, pound-foot |
414
+
415
+ ## 35. Luminous flux
416
+
417
+ These units are defined in `UnitMeasurements::LuminousFlux`.
418
+
419
+ | # | Name | Aliases |
420
+ |:--|:--|:--|
421
+ | _1_ | _lm*_ | _lumen, lumens_ |
422
+
423
+ ## 36. Illuminance
424
+
425
+ These units are defined in `UnitMeasurements::Illuminance`.
426
+
427
+ | # | Name | Aliases |
428
+ |:--|:--|:--|
429
+ | _1_ | _lx*_ | _lux, lm/m², lm/m^2, lm·m⁻², lumen per square metre, lumen per square meter_ |
430
+ | 2 | ph | phot, phots, lm/cm², lm/cm^2, lm·cm⁻², lumen per square centimetre, lumen per square centimeter |
431
+ | 3 | fc | footcandle, lm/ft², lm/ft^2, lm·ft⁻², lumen per square foot |
432
+ | 4 | nx | nox |
433
+
434
+ ## 37. Luminance
435
+
436
+ These units are defined in `UnitMeasurements::Luminance`.
437
+
438
+ | # | Name | Aliases |
439
+ |:--|:--|:--|
440
+ | _1_ | _cd/m²_ | _cd/m^2, cd·m⁻², candela per square metre, candelas per square metre, candela per square meter, candelas per square meter_ |
441
+ | 2 | cd/in² | cd/in^2, cd·in⁻², candela per square inch, candelas per square inch |
442
+ | 3 | cd/ft² | cd/ft^2, cd·ft⁻², candela per square foot, candelas per square foot |
443
+ | 4 | fL | ft-L, foot lambert, foot-lambert |
444
+ | 5 | L | lambert, lamberts |
445
+ | 6 | sb | stlib |
446
+
447
+ ## 38. Frequency
448
+
449
+ These units are defined in `UnitMeasurements::Frequency`.
450
+
451
+ | # | Name | Aliases |
452
+ |:--|:--|:--|
453
+ | _1_ | _Hz*_ | _hertz, hertzes_ |
454
+ | 2 | rad/s | rad·s⁻¹, radian per second, radians per second |
455
+ | 3 | deg/s | °/s, deg·s⁻¹, degree per second, degrees per second |
456
+ | 4 | rev/s | rps, rev·s⁻¹, revolution per second, revolutions per second |
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.2.0
4
+ version: 4.4.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-06 00:00:00.000000000 Z
11
+ date: 2023-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -138,7 +138,11 @@ files:
138
138
  - lib/unit_measurements/unit_groups/electrical_inductance.rb
139
139
  - lib/unit_measurements/unit_groups/electrical_resistance.rb
140
140
  - lib/unit_measurements/unit_groups/force.rb
141
+ - lib/unit_measurements/unit_groups/frequency.rb
142
+ - lib/unit_measurements/unit_groups/illuminance.rb
141
143
  - lib/unit_measurements/unit_groups/length.rb
144
+ - lib/unit_measurements/unit_groups/luminance.rb
145
+ - lib/unit_measurements/unit_groups/luminous_flux.rb
142
146
  - lib/unit_measurements/unit_groups/luminous_intensity.rb
143
147
  - lib/unit_measurements/unit_groups/magnetic_field.rb
144
148
  - lib/unit_measurements/unit_groups/magnetic_flux.rb