fe_core_ext 0.21.0 → 0.24.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: 4fa4a8e68b321faf97b0ec9301eac4469b7479c8edc610facdcf0569f02df48a
4
+ data.tar.gz: e9e127b82eab23c4343c1ea4b6fae498666f08e84515b050f3a1001aa5241685
5
5
  SHA512:
6
- metadata.gz: 8307fd7f008f9b864d394b8cb954fd957e88ab5236c32aaea05561f394dfb92c11c08ec541425f12b3c8afab23479f602ddf1e78ca2c4b6181e5e3ad76ca706f
7
- data.tar.gz: 7bf2701a91ebb4e8d8c86545733fa19d44420e732e488d1a76a4ae9da87a315fbe5e201a1cba7fa7f98b4c0f931a21b060bf46dea58e7441c063cb5d24a26877
6
+ metadata.gz: 5e877fdfa2236587a617f10e42e7449445228e4ca4fe3a886efd4d18e3abee2f542d941972f3a57b221e21fcf0161df7e3b7777fb873767f1a551dda87fd0c63
7
+ data.tar.gz: e7c232fc5719e763ab47b3eccb4ccaa4ef346abae712fa637cbb1ea869783ecea9c7d314e49adbe418c0cae222c389f75f227c414a1811d9c201ac9d6b941f11
@@ -16,16 +16,20 @@ 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
22
29
  def parsable?(string)
23
- begin
24
- parse(string)
25
- true
26
- rescue ArgumentError
27
- false
28
- end
30
+ parsed_hash = _parse(string)
31
+ return true if parsed_hash.has_key?(:year) && parsed_hash.has_key?(:mon)
32
+ false
29
33
  end
30
34
 
31
35
  def parse_as_future(string)
@@ -32,6 +32,10 @@ module FeCoreExt::CoreExt::Pathname
32
32
  self
33
33
  end
34
34
 
35
+ def copy(dest)
36
+ FileUtils.cp(self, dest)
37
+ end
38
+
35
39
  def require_relative
36
40
  Kernel.require_relative(self)
37
41
  end
@@ -1,3 +1,3 @@
1
1
  module FeCoreExt
2
- VERSION = '0.21.0'
2
+ VERSION = '0.24.0'
3
3
  end
data/lib/fe_core_ext.rb CHANGED
@@ -1,14 +1,14 @@
1
- require 'fe_core_ext/version'
2
- require 'fe_core_ext/core_ext/array'
3
- require 'fe_core_ext/core_ext/csv'
4
- require 'fe_core_ext/core_ext/date'
5
- require 'fe_core_ext/core_ext/hash'
6
- require 'fe_core_ext/core_ext/integer'
7
- require 'fe_core_ext/core_ext/numeric'
8
- require 'fe_core_ext/core_ext/pathname'
9
- require 'fe_core_ext/core_ext/string'
10
- require 'fe_core_ext/core_ext/time'
11
- require 'fe_core_ext/core_ext/uri'
1
+ require_relative 'fe_core_ext/version'
2
+ require_relative 'fe_core_ext/core_ext/array'
3
+ require_relative 'fe_core_ext/core_ext/csv'
4
+ require_relative 'fe_core_ext/core_ext/date'
5
+ require_relative 'fe_core_ext/core_ext/hash'
6
+ require_relative 'fe_core_ext/core_ext/integer'
7
+ require_relative 'fe_core_ext/core_ext/numeric'
8
+ require_relative 'fe_core_ext/core_ext/pathname'
9
+ require_relative 'fe_core_ext/core_ext/string'
10
+ require_relative 'fe_core_ext/core_ext/time'
11
+ require_relative 'fe_core_ext/core_ext/uri'
12
12
 
13
13
  module FeCoreExt
14
14
  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.24.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-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport