unit_measurements 2.3.0 → 2.5.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: 67c5ee8b823f832170f2f598b6babdf781ffec7d5d8a15b8fb8a46ec235470be
4
- data.tar.gz: 36e124d5b976ac6449c39912947d592867dd5c8f94cb9e7aeb3aa43f6f145454
3
+ metadata.gz: a1e54b9e8726c0a2fd3740f367a5ad4194f8f5f0d3026dfea34b4a2c22805520
4
+ data.tar.gz: 4d4232bac494619070f54e4062009bf8426f058e3900a7c9f3a1dddb0e191071
5
5
  SHA512:
6
- metadata.gz: ea1d92a563d2f801a7714d49f742bf39da3ea6e182f1d43732891f21ffe516bed7f9e619cb4f5916805e576ec73e3a7f9b886319c2ae39ef0f9283eb1bf6caef
7
- data.tar.gz: d3db4e874a9c3d7dca725657befda9bf051966974bac3458b1d24b6560326a1cc4a36dfd9451224bc0410e720be96e9463e38c91bfd429ab75b255960bae5525
6
+ metadata.gz: 126901d82bfd00b119e847a32206c0bc0bc51f2c277c1ee2da721e3c142785d67d18e43c88062ace020d08f5da80d31d6e4c5289e48b6a7eded1692b00d52878
7
+ data.tar.gz: '09472081f85dbe8a3bbd8d8380ca700cf0e39a63ff167ddab00fd0b2e7368e596d3051c94e5cde27c019930ca1f4cb2a224e793fe80f24ddf7770da560074b94'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## [2.5.0](https://github.com/shivam091/unit_measurements/compare/v2.4.0...v2.5.0) - 2023-08-23
2
+
3
+ ### What's new
4
+
5
+ - Added unit group for `sound level` units.
6
+ - Added unit group for `plane angle` units.
7
+
8
+ ----------
9
+
10
+ ## [2.4.0](https://github.com/shivam091/unit_measurements/compare/v2.3.0...v2.4.0) - 2023-08-23
11
+
12
+ ### What's new
13
+
14
+ - Added unit group for `density` units.
15
+ - Added unit group for `quantity` units.
16
+
17
+ ----------
18
+
1
19
  ## [2.3.0](https://github.com/shivam091/unit_measurements/compare/v2.2.0...v2.3.0) - 2023-08-22
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 (2.3.0)
4
+ unit_measurements (2.5.0)
5
5
  activesupport (~> 7.0)
6
6
 
7
7
  GEM
@@ -16,3 +16,9 @@ require_relative "weight"
16
16
 
17
17
  require_relative "area"
18
18
  require_relative "volume"
19
+ require_relative "density"
20
+
21
+ ## Other units
22
+ require_relative "plane_angle"
23
+ require_relative "sound_level"
24
+ require_relative "quantity"
@@ -0,0 +1,13 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::Density = UnitMeasurements.build do
6
+ base :"g/m³", aliases: [:"g/m^3", :"g·m⁻³", :"gram per cubic meter", :"grams per cubic meter", :"gramme per cubic metre", :"grammes per cubic metre"]
7
+
8
+ unit :"g/l", value: "1 kg/m³", aliases: [:"g·l⁻¹", :"gram per liter", :"grams per liter", :"gramme per litre", :"grammes per litre"]
9
+ unit :"g/ml", value: "1000 g/l", aliases: [:"g·ml⁻¹", :"gram per milliliter", :"grams per milliliter", :"gramme per millilitre", :"grammes per millilitre"]
10
+
11
+ unit :"kg/m³", value: "1000 g/m³", aliases: [:"kg/m^3", :"kg·m⁻³", :"kilogram per cubic meter", :"kilograms per cubic meter", :"kilogramme per cubic metre", :"kilogrammes per cubic metre"]
12
+ unit :"kg/l", value: "1e+6 g/m³", aliases: [:"kg·l⁻¹", :"kilogram per liter", :"kilograms per liter", :"kilogramme per litre", :"kilogrammes per litre"]
13
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::PlaneAngle = UnitMeasurements.build do
6
+ si_unit :rad, aliases: [:radian, :radians]
7
+
8
+ unit :deg, value: [(Math::PI / 180), :rad], aliases: [:°, :degree, :degrees] # (π / 180) rad
9
+ unit :gon, value: [(Math::PI / 200), :rad], aliases: [:ᵍ, :grad, :gradian, :gradians] # (π / 200) rad
10
+ unit :cir, value: "360 deg", aliases: [:circle, :circles] # (2 * π) rad
11
+ unit :mil, value: "1/6400 cir", aliases: [:mils] # ((2 * π) / 6400) rad
12
+ unit :rev, value: "1 cir", aliases: [:revolution, :revolutions] # (2 * π) rad
13
+
14
+ unit :brad, value: [(Math::PI / 128), :rad], aliases: [:b°, :bdeg, :"binary degree", :"binary radian", :"binary degrees", :"binary radians"] # (π / 128) rad
15
+
16
+ unit :arcmin, value: "1/60 deg", aliases: [:′, :amin, :arcminute, :arcminutes] # ((π / 180) / 60) rad
17
+ unit :arcsec, value: "1/60 arcmin", aliases: [:″, :asec, :arcsecond, :arcseconds] # ((π / 180) / 3600) rad
18
+ end
@@ -0,0 +1,12 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::Quantity = UnitMeasurements.build do
6
+ base :pc, aliases: [:pcs, :piece, :pieces]
7
+
8
+ unit :pr, value: "2 pc", aliases: [:pair, :pairs]
9
+ unit :dz, value: "6 pr", aliases: [:doz, :dozen, :dozens]
10
+ unit :gr, value: "12 doz", aliases: [:gross, :grosses]
11
+ unit :gg, value: "12 gr", aliases: [:"great gross", :"great grosses", :"grand gross", :"grand grosses", :"dozen gross", :"dozen grosses"]
12
+ end
@@ -0,0 +1,9 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::SoundLevel = UnitMeasurements.build do
6
+ si_unit :B, aliases: [:bel, :bels]
7
+
8
+ unit :Np, value: [(20 / Math.log(10)), :dB], aliases: [:neper, :nepers] # (20 / ln(10)) dB
9
+ end
@@ -3,5 +3,5 @@
3
3
  # -*- warn_indent: true -*-
4
4
 
5
5
  module UnitMeasurements
6
- VERSION = "2.3.0"
6
+ VERSION = "2.5.0"
7
7
  end
data/units.md CHANGED
@@ -116,3 +116,52 @@ These units are defined in `UnitMeasurements::Volume`.
116
116
  | 8 | ft³ | ft^3, cu ft, cubic foot, cubic feet |
117
117
  | 9 | yd³ | yd^3, cu yd, cubic yard, cubic yards |
118
118
  | 10 | mi³ | mi^3, cu mi, cubic mile, cubic miles |
119
+
120
+ ## 10. Density
121
+
122
+ These units are defined in `UnitMeasurements::Density`.
123
+
124
+ | # | Name | Aliases |
125
+ |:--|:--|:--|
126
+ | **1** | **g/m³** | **g/m^3, g·m⁻³, gram per cubic meter, grams per cubic meter, gramme per cubic metre, grammes per cubic metre** |
127
+ | 2 | kg/m³ | kg/m^3, kg·m⁻³, kilogram per cubic meter, kilograms per cubic meter, kilogramme per cubic metre, kilogrammes per cubic metre |
128
+ | 3 | g/l | g·l⁻¹, gram per liter, grams per liter, gramme per litre, grammes per litre |
129
+ | 4 | g/ml | g·ml⁻¹, gram per milliliter, grams per milliliter, gramme per millilitre, grammes per millilitre |
130
+ | 5 | kg/l | kg·l⁻¹, kilogram per liter, kilograms per liter, kilogramme per litre, kilogrammes per litre |
131
+
132
+ ## 11. Quantity
133
+
134
+ These units are defined in `UnitMeasurements::Quantity`.
135
+
136
+ | # | Name | Aliases |
137
+ |:--|:--|:--|
138
+ | **1** | **pc** | **pcs, piece, pieces** |
139
+ | 2 | pr | pair, pairs |
140
+ | 3 | gr | gross, grosses |
141
+ | 4 | dz | doz, dozen, dozens |
142
+ | 5 | gg | great gross, great grosses, grand gross, grand grosses, dozen gross, dozen grosses |
143
+
144
+ ## 12. Sound level
145
+
146
+ These units are defined in `UnitMeasurements::SoundLevel`.
147
+
148
+ | # | Name | Aliases |
149
+ |:--|:--|:--|
150
+ | **1** | **B\*** | **bel, bels** |
151
+ | 2 | Np | neper, nepers |
152
+
153
+ ## 13. Plane angle
154
+
155
+ These units are defined in `UnitMeasurements::PlaneAngle`.
156
+
157
+ | # | Name | Aliases |
158
+ |:--|:--|:--|
159
+ | **1** | **rad\*** | **radian, radians** |
160
+ | 2 | deg | °, degree, degrees |
161
+ | 3 | gon | ᵍ, grad, gradian, gradians |
162
+ | 4 | cir | circle, circles |
163
+ | 5 | mil | mils |
164
+ | 6 | rev | revolution, revolutions |
165
+ | 7 | brad | b°, bdeg, binary degree, binary radian, binary degrees, binary radians |
166
+ | 8 | arcmin | ′, amin, arcminute, arcminutes |
167
+ | 9 | arcsec | ″, asec, arcsecond, arcseconds |
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: 2.3.0
4
+ version: 2.5.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-09-22 00:00:00.000000000 Z
11
+ date: 2023-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -121,9 +121,13 @@ files:
121
121
  - lib/unit_measurements/unit_groups/all.rb
122
122
  - lib/unit_measurements/unit_groups/amount_of_substance.rb
123
123
  - lib/unit_measurements/unit_groups/area.rb
124
+ - lib/unit_measurements/unit_groups/density.rb
124
125
  - lib/unit_measurements/unit_groups/electric_current.rb
125
126
  - lib/unit_measurements/unit_groups/length.rb
126
127
  - lib/unit_measurements/unit_groups/luminous_intensity.rb
128
+ - lib/unit_measurements/unit_groups/plane_angle.rb
129
+ - lib/unit_measurements/unit_groups/quantity.rb
130
+ - lib/unit_measurements/unit_groups/sound_level.rb
127
131
  - lib/unit_measurements/unit_groups/temperature.rb
128
132
  - lib/unit_measurements/unit_groups/time.rb
129
133
  - lib/unit_measurements/unit_groups/volume.rb