fe_core_ext 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fe_core_ext/core_ext/date.rb +7 -0
- data/lib/fe_core_ext/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: 40a82d9a157130e37dd3382a5b5242e076e2aa4a140585a56f5323a055aaaeb4
|
4
|
+
data.tar.gz: 648beb0c8356d7f00949a60cbb260f1625c38f9d5e50a1af472b00186f02aa00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c675b7274fdda7caebbc9ff30109a2853e97a554419f4b6dffd383d98dfa55549a39430f07eaa777a0858afe263bb44c0a13dc1bd72f116dc68fcc02b40a3420
|
7
|
+
data.tar.gz: f376469defd3b0a8372efebfb6a2bc75a765c83188b94a405831f3d0047e8401f35a6a542fea60648dbdb35a8d8e0e9cd8d2648866c27829de9d2dee0ef3f60a
|
@@ -16,6 +16,13 @@ module FeCoreExt::CoreExt::Date
|
|
16
16
|
def to_time_range
|
17
17
|
Range.new(beginning_of_day, end_of_day)
|
18
18
|
end
|
19
|
+
|
20
|
+
def nth_weekday(nth, weekday)
|
21
|
+
first_day = Date.new(self.year, self.month, 1)
|
22
|
+
weekdays_hash = {sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6}
|
23
|
+
weekday_dates = (first_day..first_day.end_of_month).select{|d| d.wday == weekdays_hash[weekday]}
|
24
|
+
weekday_dates[nth - 1]
|
25
|
+
end
|
19
26
|
end
|
20
27
|
|
21
28
|
module FeCoreExt::CoreExt::DateClassMethods
|
data/lib/fe_core_ext/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fe_core_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tetsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|