fe_core_ext 0.19.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0364ab21f7962e38946bcc1eaa4a5ce21fa8571a9b213dad6e8111364cc74da
4
- data.tar.gz: 608b759ccf5e6f4757ab34e9de5cea96089085fa2dab1b3fca127a55e4c33ef8
3
+ metadata.gz: 40a82d9a157130e37dd3382a5b5242e076e2aa4a140585a56f5323a055aaaeb4
4
+ data.tar.gz: 648beb0c8356d7f00949a60cbb260f1625c38f9d5e50a1af472b00186f02aa00
5
5
  SHA512:
6
- metadata.gz: 857122c00132f4033cd38797164b77e21bcf7e6402f870d138d91df72a0074db6cabf7a49224f3f3e9490702a46fbc0d48e0b78d77a0fe8d4806f6d280aa6852
7
- data.tar.gz: eda69153e67aa641014cc7305fe61992aad8065723f9e2fae1ba5241dd60a5e132553b94be95be36dd4adccd241dc802efcc73535b499d05d4040f234210b717
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
@@ -15,6 +15,10 @@ module FeCoreExt::CoreExt::Pathname
15
15
  Pathname.glob(join(pattern), &block)
16
16
  end
17
17
 
18
+ def existence
19
+ self if exist?
20
+ end
21
+
18
22
  def touch(options={})
19
23
  FileUtils.touch(@path, options)
20
24
  end
@@ -17,7 +17,7 @@ module FeCoreExt::CoreExt::String
17
17
  end
18
18
 
19
19
  def to_decimal
20
- return if not_number?
20
+ return unless valid_number?
21
21
  delete(',').to_d
22
22
  end
23
23
 
@@ -1,3 +1,3 @@
1
1
  module FeCoreExt
2
- VERSION = '0.19.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.19.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-05-18 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