timely 0.13.0 → 0.14.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: ef6629b2db8417d5ba9d5506bf8b68ae9211bfc75c372c88c8221d5486497de5
4
- data.tar.gz: a8989c57a326a2efbd1e8e204d028eb38e8472a3459949295b672803e752930e
3
+ metadata.gz: 76d53f7128d1f8fefc57f6c424ba275bc4ecb2a417ec36f81424b9e71b2859d8
4
+ data.tar.gz: 224b5a5144121bb69d2c01cd0dd79f21a70a58a2d92fe206ee58fc3ddb3cb809
5
5
  SHA512:
6
- metadata.gz: 90b550e3990d4026403ea150fd273975ba38f221a6dc065dcd89b9e0545088c1df2f19ff22470a96f50f6829e950f3f710a1985ce42184c78ddba3290ed0297f
7
- data.tar.gz: dc5d1a349c7d9325aa2a373471c4cd7fedfba85d8be08d26fa3c2202babd6a00c7ccd36c426111491a2bfa104c58d0386a135a67062e9d7cd93424c5dbc15498
6
+ metadata.gz: e6210ba90bcca9ee930c78e5c5487fd9f30145ec32a15b896ebd1aaf0428bd9b8d8a0c98df95b443d9c2935e66efffd9788bf48428f5cbf5c0afb5b40c1f6f30
7
+ data.tar.gz: 7310aa84aadf17a0159652fc11c84295966fdf552759f4dfabfa169895768f8508f35be1a59d6bde4681c11e84e15989c2158024317eaeabd694969271c5b133
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.0
4
+
5
+ - [TF-36] Add to_seconds method in Period class
6
+
3
7
  ## 0.13.0
4
8
 
5
9
  - [PLAT-1175] Update to Ruby 3.2
@@ -29,5 +29,30 @@ module Timely
29
29
  def to_s
30
30
  "#{number} #{units.to_s.gsub('_', '')}"
31
31
  end
32
+
33
+ def to_seconds
34
+ case units
35
+ when :seconds
36
+ number
37
+ when :minutes
38
+ number.minute.in_seconds
39
+ when :hours
40
+ number.hour.in_seconds
41
+ when :days
42
+ number.day.in_seconds
43
+ when :weeks
44
+ number.week.in_seconds
45
+ when :months
46
+ number.month.in_seconds
47
+ when :years
48
+ number.year.in_seconds
49
+ when :calendar_days
50
+ ::Time.now.advance(days: number - 1).end_of_day - ::Time.now
51
+ when :calendar_months
52
+ ::Time.now.advance(months: number - 1).end_of_month - ::Time.now
53
+ when :calendar_years
54
+ ::Time.now.advance(years: number - 1).end_of_year - ::Time.now
55
+ end
56
+ end
32
57
  end
33
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Timely
4
- VERSION = '0.13.0'
4
+ VERSION = '0.14.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Noack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-17 00:00:00.000000000 Z
11
+ date: 2023-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord