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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/timely/rails/period.rb +25 -0
- data/lib/timely/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76d53f7128d1f8fefc57f6c424ba275bc4ecb2a417ec36f81424b9e71b2859d8
|
4
|
+
data.tar.gz: 224b5a5144121bb69d2c01cd0dd79f21a70a58a2d92fe206ee58fc3ddb3cb809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6210ba90bcca9ee930c78e5c5487fd9f30145ec32a15b896ebd1aaf0428bd9b8d8a0c98df95b443d9c2935e66efffd9788bf48428f5cbf5c0afb5b40c1f6f30
|
7
|
+
data.tar.gz: 7310aa84aadf17a0159652fc11c84295966fdf552759f4dfabfa169895768f8508f35be1a59d6bde4681c11e84e15989c2158024317eaeabd694969271c5b133
|
data/CHANGELOG.md
CHANGED
data/lib/timely/rails/period.rb
CHANGED
@@ -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
|
data/lib/timely/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|