unit_measurements 1.7.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbb7978f79ac8f4fac738ef87936cf1bf20397c74772c35120205aed22d1ac1c
4
- data.tar.gz: 1b99cb2665a071d0e721f78cabad86fc50a39e2eda8349bd5813ba80c48afe89
3
+ metadata.gz: 8601bdbb7fb37856840869d267729adefddbf714ab6696376d6165252f9531f3
4
+ data.tar.gz: 33c504c31db58c752ecb4b587112ae2df4b0af6c0e1efd957af1202e635e3622
5
5
  SHA512:
6
- metadata.gz: 27da14501c804050def9568138cfcab08b7b81eeab9d47ba3c23117534d2f32f33ed42260c9199d95f1c5cc71e715d1844cc493be34e347989c9fb71932fb058
7
- data.tar.gz: e6c5e47ab28b199599cc7b86b748205d3124c52fbbdfb83a38849876177764e280ce6d324336908ebdff0eff6a3acdb98b8cf8a8bc94ef8f325deca2d378f560
6
+ metadata.gz: 119bd53409c40aac1242b0721e3737e65231a2e243e1e0151ede230b5b2f76358679a63a0b9fc66c8ec8bf5fda9b9395a8539c8ad2f6fd08933edc8717ffaa6d
7
+ data.tar.gz: 3a5ed9b00ec6e5abee27bc8fd653e5c8c069ad18c5c5cac2c4dbcba519f1c72cbd574243f8c5e955fb4a896a737434b376395b2b4a46e114e40b473292fe04b8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [2.1.0](https://github.com/shivam091/unit_measurements/compare/v1.7.0...v2.1.0) - 2023-08-21
2
+
3
+ ### What's new
4
+
5
+ - Added unit group for `time` units.
6
+ - Added unit group for `amount of substance` units.
7
+
8
+ ----------
9
+
1
10
  ## [1.7.0](https://github.com/shivam091/unit_measurements/compare/v1.6.0...v1.7.0) - 2023-08-20
2
11
 
3
12
  ### What's new
@@ -76,10 +85,10 @@
76
85
 
77
86
  ----------
78
87
 
79
- ## [0.1.0] - 2023-09-13
88
+ ## 0.1.0 - 2023-09-13
80
89
 
81
90
  ### Initial release
82
91
 
83
92
  -----------
84
93
 
85
- ## [Unreleased]
94
+ ### Unreleased
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unit_measurements (1.7.0)
4
+ unit_measurements (2.1.0)
5
5
  activesupport (~> 7.0)
6
6
 
7
7
  GEM
@@ -2,5 +2,7 @@
2
2
  # -*- frozen_string_literal: true -*-
3
3
  # -*- warn_indent: true -*-
4
4
 
5
+ require_relative "amount_of_substance"
5
6
  require_relative "length"
7
+ require_relative "time"
6
8
  require_relative "weight"
@@ -0,0 +1,9 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::AmountOfSubstance = UnitMeasurements.build do
6
+ si_unit :mol, aliases: [:mole, :moles]
7
+
8
+ unit :NA, value: "1.6605389210322e-24 mol", aliases: [:"avogadro constant"]
9
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # -*- frozen_string_literal: true -*-
3
+ # -*- warn_indent: true -*-
4
+
5
+ UnitMeasurements::Time = UnitMeasurements.build do
6
+ si_unit :s, aliases: [:sec, :second, :seconds]
7
+
8
+ unit :h, value: "60 min", aliases: [:hr, :hour, :hours]
9
+ unit :d, value: "24 h", aliases: [:day, :days]
10
+ unit :wk, value: "7 d", aliases: [:week, :weeks]
11
+ unit :fn, value: "2 wk", aliases: [:"4tnite", :fortnight, :fortnights]
12
+ unit :mo, value: "30.4167 d", aliases: [:month, :months]
13
+ unit :yr, value: "365 d", aliases: [:y, :year, :years]
14
+ unit :min, value: "60 s", aliases: [:minute, :minutes]
15
+ unit :qtr, value: "3 mo", aliases: [:quarter, :quarters]
16
+ unit :dec, value: "10 y", aliases: [:decade, :decades]
17
+ unit :cent, value: "10 dec", aliases: [:century, :centuries]
18
+ end
@@ -3,5 +3,5 @@
3
3
  # -*- warn_indent: true -*-
4
4
 
5
5
  module UnitMeasurements
6
- VERSION = "1.7.0"
6
+ VERSION = "2.1.0"
7
7
  end
data/units.md CHANGED
@@ -30,3 +30,30 @@ These units are defined in `UnitMeasurements::Weight`.
30
30
  | **1** | **g\*** | **gram, grams, gramme, grammes** |
31
31
  | 2 | q | quintal, quintals |
32
32
  | 3 | t | tonne, tonnes, metric tonne, metric tonnes |
33
+
34
+ ## 3. Time
35
+
36
+ These units are defined in `UnitMeasurements::Time`.
37
+
38
+ | # | Name | Aliases |
39
+ |:--|:--|:--|
40
+ | **1** | **s\*** | **sec, second, seconds** |
41
+ | 2 | h | hr, hour, hours |
42
+ | 3 | d | day, days |
43
+ | 4 | wk | week, weeks |
44
+ | 5 | fn | 4tnite, fortnight, fortnights |
45
+ | 6 | mo | month, months |
46
+ | 7 | yr | y, year, years |
47
+ | 8 | min | minute, minutes |
48
+ | 9 | qtr | quarter, quarters |
49
+ | 10 | dec | decade, decades |
50
+ | 11 | cent | century, centuries |
51
+
52
+ ## 4. Amount of substance
53
+
54
+ These units are defined in `UnitMeasurements::AmountOfSubstance`.
55
+
56
+ | # | Symbol | Aliases |
57
+ |:--|:--|:--|
58
+ | **1** | **mol\*** | **mole, moles** |
59
+ | 2 | NA | avogadro constant |
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unit_measurements
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harshal LADHE
@@ -119,7 +119,9 @@ files:
119
119
  - lib/unit_measurements/unit_group.rb
120
120
  - lib/unit_measurements/unit_group_builder.rb
121
121
  - lib/unit_measurements/unit_groups/all.rb
122
+ - lib/unit_measurements/unit_groups/amount_of_substance.rb
122
123
  - lib/unit_measurements/unit_groups/length.rb
124
+ - lib/unit_measurements/unit_groups/time.rb
123
125
  - lib/unit_measurements/unit_groups/weight.rb
124
126
  - lib/unit_measurements/version.rb
125
127
  - unit_measurements.gemspec