ruby-rails-extensions 1.1.0 → 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: 066eeb0d0c0c755afd91c41eaf18e9e1446635d8fcc80bf37e4d3b9fd76348dd
4
- data.tar.gz: 321af547a582a1059aeea22b1a9582ab9fb6a513eb4c08041b52e96c6ded0586
3
+ metadata.gz: bf794ed4a9a72cdc07757df5f1f619803239d62e4b9b01afa7c1d9463e77867f
4
+ data.tar.gz: d12accd27f98ce0dabde97fb9b66293f8156a01fca6a7b5460c11ac927d5b0c0
5
5
  SHA512:
6
- metadata.gz: 3bb6a7aab3a148d1c6267e014c782a7c1a227fa0c784ed8b2d52ecd370d025559c0a7aba414ad4b8a1b19256ea661bc647177203b8263a0a254cc4fe189b9f12
7
- data.tar.gz: 6d3574d41a547413f41ce0b397646a7b2002a0585ba77d24eb5f4bada7d719c78c49be78348529b4a42cd6014d2a065dd1cc1c396ab45815c5c3e55f34ec2785
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'
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
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
@@ -115,9 +115,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: 3.0.1
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - ">="
118
+ - - ">"
119
119
  - !ruby/object:Gem::Version
120
- version: '0'
120
+ version: 1.3.1
121
121
  requirements: []
122
122
  rubygems_version: 3.2.15
123
123
  signing_key: