ruby-rails-extensions 1.1.0.pre.rc.1 → 1.1.1.pre.rc.1

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: 8bfe888c5a0bc6a8542e1836c8e96b6660285263169a1982ebf7fc93bc837a21
4
- data.tar.gz: 651208392b2a60e9b36a9b845c1937c5a75a99bbf05872b68dc44fa2a49b0bbf
3
+ metadata.gz: bf794ed4a9a72cdc07757df5f1f619803239d62e4b9b01afa7c1d9463e77867f
4
+ data.tar.gz: d12accd27f98ce0dabde97fb9b66293f8156a01fca6a7b5460c11ac927d5b0c0
5
5
  SHA512:
6
- metadata.gz: a3a3ed90725bd9a2abb39d3d6cabb17b427082af51e923c668226176c9467b06695f735417243b651777dc363dc5c517b5a86b83287b5f1405df89ed5d05565b
7
- data.tar.gz: ee96065885e04d3afa8d1ce6a293142edd672f6588993f0a8f793cf24a08b20888aa803ea962e14c5d75a22fb39286610042153191a893cb8301c4bde189b097
6
+ metadata.gz: 0d9eed2fce25b074518af012158ce4397f694617367a6ea0efa15b6172b3f34c83fc4d66a5509b10094569138fec50e8b99751ba4cf7dc16516df2fad1ac24e6
7
+ data.tar.gz: 70f9521f9852f0231c825e5903157caec270aa7c23c990cc1bf63c29cbc8ba992037d294905178048777659d86b1dd7732c57ed5c50bd9000536e85b1e61c464
data/CHANGELOG.md CHANGED
@@ -1,6 +1,19 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.1.1 (2024-03-01)
5
+ ------------------
6
+
7
+ * Bugs fixed:
8
+ * Custom methods added to `DateTime`/`Time` were not added correctly if also added to `Date`
9
+ * Modules affected:
10
+ * 'current_month'
11
+ * 'current_week'
12
+ * 'day_of_week'
13
+ * 'display_user'
14
+ * 'input'
15
+ * 'safe_parse'
16
+
4
17
  1.1.0 (2023-09-27)
5
18
  ------------------
6
19
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- Date.class_eval do
5
+ DateTime.class_eval do
6
6
  unless method_defined?(:current_month)
7
7
  # :nodoc:
8
8
  def current_month
@@ -11,7 +11,7 @@ Date.class_eval do
11
11
  end
12
12
  end
13
13
 
14
- DateTime.class_eval do
14
+ Date.class_eval do
15
15
  unless method_defined?(:current_month)
16
16
  # :nodoc:
17
17
  def current_month
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- Date.class_eval do
5
+ DateTime.class_eval do
6
6
  unless method_defined?(:current_week)
7
7
  # @return Range<Date>
8
8
  def current_week
@@ -11,7 +11,7 @@ Date.class_eval do
11
11
  end
12
12
  end
13
13
 
14
- DateTime.class_eval do
14
+ Date.class_eval do
15
15
  unless method_defined?(:current_week)
16
16
  # @return Range<Date>
17
17
  def current_week
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- Date.class_eval do
5
+ DateTime.class_eval do
6
6
  unless method_defined?(:day_of_week)
7
7
  # @return [String] - Full day word
8
8
  def day_of_week
@@ -11,7 +11,7 @@ Date.class_eval do
11
11
  end
12
12
  end
13
13
 
14
- DateTime.class_eval do
14
+ Date.class_eval do
15
15
  unless method_defined?(:day_of_week)
16
16
  # @return [String] - Full day word
17
17
  def day_of_week
@@ -2,29 +2,29 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- Date.class_eval do
5
+ DateTime.class_eval do
6
6
  unless method_defined?(:display_user)
7
7
  # @return [String] - mm/dd/yyyy or m/d/yy
8
8
  def display_user(all = false)
9
- strftime(all ? '%m/%d/%Y' : '%-m/%-d/%y')
9
+ strftime(all ? '%m/%d/%Y %r' : '%-m/%-d/%y %r')
10
10
  end
11
11
  end
12
12
  end
13
13
 
14
- DateTime.class_eval do
14
+ Time.class_eval do
15
15
  unless method_defined?(:display_user)
16
16
  # @return [String] - mm/dd/yyyy or m/d/yy
17
17
  def display_user(all = false)
18
- strftime(all ? '%m/%d/%Y %r' : '%-m/%-d/%y %r')
18
+ to_datetime.display_user(all)
19
19
  end
20
20
  end
21
21
  end
22
22
 
23
- Time.class_eval do
23
+ Date.class_eval do
24
24
  unless method_defined?(:display_user)
25
25
  # @return [String] - mm/dd/yyyy or m/d/yy
26
26
  def display_user(all = false)
27
- to_datetime.display_user(all)
27
+ strftime(all ? '%m/%d/%Y' : '%-m/%-d/%y')
28
28
  end
29
29
  end
30
30
  end
@@ -2,20 +2,20 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- Date.class_eval do
5
+ DateTime.class_eval do
6
6
  unless method_defined?(:input)
7
- # @return [String] - yyyy-mm-dd
8
- def input(_all = false)
9
- strftime('%F')
7
+ # @return [String] - yyyy-mm-dd[Thh:mm::ss]
8
+ def input(all = false)
9
+ strftime(all ? '%F %T' : '%F')
10
10
  end
11
11
  end
12
12
  end
13
13
 
14
- DateTime.class_eval do
14
+ Date.class_eval do
15
15
  unless method_defined?(:input)
16
- # @return [String] - yyyy-mm-dd[Thh:mm::ss]
17
- def input(all = false)
18
- strftime(all ? '%F %T' : '%F')
16
+ # @return [String] - yyyy-mm-dd
17
+ def input(_all = false)
18
+ strftime('%F')
19
19
  end
20
20
  end
21
21
  end
@@ -1,18 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Date.class_eval do
4
- class << self
5
- unless method_defined?(:safe_parse)
6
- # Parses the `str` and returns `nil` if invalid
7
- def safe_parse(str)
8
- parse(str)
9
- rescue
10
- nil
11
- end
12
- end
13
- end
14
- end
15
-
16
3
  Time.class_eval do
17
4
  class << self
18
5
  unless method_defined?(:safe_parse)
@@ -40,3 +27,16 @@ if defined?(ActiveSupport::TimeZone)
40
27
  end
41
28
  end
42
29
  end
30
+
31
+ Date.class_eval do
32
+ class << self
33
+ unless method_defined?(:safe_parse)
34
+ # Parses the `str` and returns `nil` if invalid
35
+ def safe_parse(str)
36
+ parse(str)
37
+ rescue
38
+ nil
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyRailsExtensions
4
- VERSION = '1.1.0-rc.1'
4
+ VERSION = '1.1.1-rc.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-rails-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.pre.rc.1
4
+ version: 1.1.1.pre.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-27 00:00:00.000000000 Z
11
+ date: 2024-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop-rubomatic-rails