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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef6b3f2b4feddc41d15a33f24b3cc758ec46d80b80f1fe96f193a94e88d5fd2c
4
- data.tar.gz: a9c3f947886aedfa34c5fbf4da55ac3b481a0b2e97ee031706317e04ba5b7a69
3
+ metadata.gz: 40a82d9a157130e37dd3382a5b5242e076e2aa4a140585a56f5323a055aaaeb4
4
+ data.tar.gz: 648beb0c8356d7f00949a60cbb260f1625c38f9d5e50a1af472b00186f02aa00
5
5
  SHA512:
6
- metadata.gz: 8307fd7f008f9b864d394b8cb954fd957e88ab5236c32aaea05561f394dfb92c11c08ec541425f12b3c8afab23479f602ddf1e78ca2c4b6181e5e3ad76ca706f
7
- data.tar.gz: 7bf2701a91ebb4e8d8c86545733fa19d44420e732e488d1a76a4ae9da87a315fbe5e201a1cba7fa7f98b4c0f931a21b060bf46dea58e7441c063cb5d24a26877
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
@@ -1,3 +1,3 @@
1
1
  module FeCoreExt
2
- VERSION = '0.21.0'
2
+ VERSION = '0.22.0'
3
3
  end
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.21.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-08 00:00:00.000000000 Z
11
+ date: 2022-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport