ruby-rails-extensions 2.4.0 → 3.0.0.rc.pre.1

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/lib/ruby-rails-extensions/extensions/all_keys.rb +1 -1
  4. data/lib/ruby-rails-extensions/extensions/all_values.rb +1 -1
  5. data/lib/ruby-rails-extensions/extensions/any_key.rb +1 -1
  6. data/lib/ruby-rails-extensions/extensions/any_value.rb +1 -1
  7. data/lib/ruby-rails-extensions/extensions/compact_blank_join.rb +1 -1
  8. data/lib/ruby-rails-extensions/extensions/compact_map.rb +2 -2
  9. data/lib/ruby-rails-extensions/extensions/current_day.rb +1 -1
  10. data/lib/ruby-rails-extensions/extensions/current_month.rb +2 -2
  11. data/lib/ruby-rails-extensions/extensions/current_week.rb +2 -2
  12. data/lib/ruby-rails-extensions/extensions/cutoff.rb +1 -1
  13. data/lib/ruby-rails-extensions/extensions/day_of_week.rb +2 -2
  14. data/lib/ruby-rails-extensions/extensions/display_military.rb +2 -2
  15. data/lib/ruby-rails-extensions/extensions/display_user.rb +4 -4
  16. data/lib/ruby-rails-extensions/extensions/find_bang.rb +2 -2
  17. data/lib/ruby-rails-extensions/extensions/find_dupes.rb +1 -1
  18. data/lib/ruby-rails-extensions/extensions/first_dupe.rb +2 -2
  19. data/lib/ruby-rails-extensions/extensions/flatten_compact.rb +2 -2
  20. data/lib/ruby-rails-extensions/extensions/google_format.rb +1 -1
  21. data/lib/ruby-rails-extensions/extensions/hash_only.rb +1 -1
  22. data/lib/ruby-rails-extensions/extensions/humanize_symbol.rb +1 -1
  23. data/lib/ruby-rails-extensions/extensions/in_utc.rb +3 -3
  24. data/lib/ruby-rails-extensions/extensions/input.rb +2 -2
  25. data/lib/ruby-rails-extensions/extensions/invert_with_dups.rb +1 -1
  26. data/lib/ruby-rails-extensions/extensions/left_deep_merge.rb +1 -1
  27. data/lib/ruby-rails-extensions/extensions/month_and_year.rb +1 -1
  28. data/lib/ruby-rails-extensions/extensions/month_year.rb +1 -1
  29. data/lib/ruby-rails-extensions/extensions/nmerge.rb +1 -1
  30. data/lib/ruby-rails-extensions/extensions/no_keys.rb +1 -1
  31. data/lib/ruby-rails-extensions/extensions/no_values.rb +1 -1
  32. data/lib/ruby-rails-extensions/extensions/only_some.rb +1 -1
  33. data/lib/ruby-rails-extensions/extensions/overlaps.rb +2 -2
  34. data/lib/ruby-rails-extensions/extensions/pipe.rb +2 -2
  35. data/lib/ruby-rails-extensions/extensions/presence_bang.rb +1 -1
  36. data/lib/ruby-rails-extensions/extensions/quarter_dates.rb +1 -1
  37. data/lib/ruby-rails-extensions/extensions/quarter_str.rb +6 -4
  38. data/lib/ruby-rails-extensions/extensions/range_add.rb +1 -1
  39. data/lib/ruby-rails-extensions/extensions/range_comparisons.rb +1 -1
  40. data/lib/ruby-rails-extensions/extensions/range_multiply.rb +1 -1
  41. data/lib/ruby-rails-extensions/extensions/range_round.rb +1 -1
  42. data/lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb +21 -19
  43. data/lib/ruby-rails-extensions/extensions/safe_parse.rb +2 -15
  44. data/lib/ruby-rails-extensions/extensions/select_present.rb +1 -1
  45. data/lib/ruby-rails-extensions/extensions/select_present_join.rb +1 -1
  46. data/lib/ruby-rails-extensions/extensions/set_to_sentence.rb +1 -1
  47. data/lib/ruby-rails-extensions/extensions/to_bool.rb +5 -5
  48. data/lib/ruby-rails-extensions/extensions/to_d.rb +2 -2
  49. data/lib/ruby-rails-extensions/extensions/to_dec.rb +3 -3
  50. data/lib/ruby-rails-extensions/extensions/to_delimited.rb +4 -4
  51. data/lib/ruby-rails-extensions/extensions/to_i.rb +2 -2
  52. data/lib/ruby-rails-extensions/extensions/to_local.rb +2 -2
  53. data/lib/ruby-rails-extensions/extensions/to_money.rb +2 -2
  54. data/lib/ruby-rails-extensions/extensions/to_negative_i.rb +3 -3
  55. data/lib/ruby-rails-extensions/extensions/to_new_date.rb +1 -1
  56. data/lib/ruby-rails-extensions/extensions/to_new_time.rb +1 -1
  57. data/lib/ruby-rails-extensions/extensions/to_nonzero_i.rb +3 -3
  58. data/lib/ruby-rails-extensions/extensions/to_or_sentence.rb +2 -2
  59. data/lib/ruby-rails-extensions/extensions/to_percentage.rb +2 -2
  60. data/lib/ruby-rails-extensions/extensions/to_positive_i.rb +3 -3
  61. data/lib/ruby-rails-extensions/extensions/to_sort_i.rb +3 -3
  62. data/lib/ruby-rails-extensions/extensions/to_x.rb +3 -3
  63. data/lib/ruby-rails-extensions/extensions/todays_date.rb +1 -1
  64. data/lib/ruby-rails-extensions/extensions/uniq_map.rb +1 -1
  65. data/lib/ruby-rails-extensions/extensions/usd_to_f.rb +3 -3
  66. data/lib/ruby-rails-extensions/extensions/usd_to_i.rb +2 -2
  67. data/lib/ruby-rails-extensions/extensions/utf8_encode.rb +1 -1
  68. data/lib/ruby-rails-extensions/extensions/weighted_sum.rb +1 -1
  69. data/lib/ruby-rails-extensions/extensions/yesno.rb +3 -3
  70. data/lib/ruby-rails-extensions/extensions/zero_range.rb +1 -1
  71. data/lib/ruby-rails-extensions/version.rb +3 -3
  72. data/lib/ruby-rails-extensions.rb +0 -2
  73. metadata +2 -4
  74. data/lib/ruby-rails-extensions/extensions/assign_nil.rb +0 -70
  75. data/lib/ruby-rails-extensions/extensions/clean_string.rb +0 -61
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5081c65167e542294aacaf7912ecd403518775de64725d4aa6b0ecd8127e9386
4
- data.tar.gz: 0d6412e60b0556a5a2f6a4d9b2b27b0448d8ef9afd8a336f0df3a516e2d82f90
3
+ metadata.gz: '01398e2ad8698b2e20e27e5dade079cc2c73011be4df8bc65fe15f9536bdcab8'
4
+ data.tar.gz: adfdcd31e90265bb956ba8df67f68628fbc93c7bb7616390666c9f993138edc7
5
5
  SHA512:
6
- metadata.gz: 91035ec22ffeb7ee127f5db66f6ead32ff58cb8b107018f6176695cb70c31d20afaf7cceb5cfa039a3d0784b185fc8df859368cff6f4658ae50a87b7090bbdbf
7
- data.tar.gz: 71ed5bbe8531ea558ed139f85bdda3ff60da8a7036cd1af813ce0dfef9ea5e7deff54e23e7d41eeda0bf4f3eca97706ea3afcfc0a4a9bb4e9a008732670bf9e0
6
+ metadata.gz: 940efc2ead96702526ae6773e53befa80eb45bec556214fc2cf9644aae61b5498d1db16ddc98e48c1af267e2eecbe8cba2a6fd5aac34004b8754cb4ef928edb0
7
+ data.tar.gz: 33948b09714dd78a2a766f79284741a6463629c724589702ac6148654d20ad08affc7eb4019dd28619e94234b73d4e9f402c4f1eb1fa21758628a8b5f5a66067
data/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.0.0 (2026-01-05)
5
+ ------------------
6
+ # Breaking changes
7
+
8
+ * The `clean_string` extension was removed
9
+ * Minimum ruby version bumped to 3.3.0
10
+ * Removed the `assign_nil` extension
11
+ * Removed `ActiveSupport::TimeZone::safe_parse`
12
+
13
+ # Other changes
14
+
15
+ * Tests added for almost every extension missing tests
16
+ * All instances of `SomeClass.class_eval` replaced with `class SomeClass`
17
+
4
18
  2.4.0 (2026-01-05)
5
19
  ------------------
6
20
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # @see Enumerable#all?
5
5
  def all_keys?(...)
6
6
  keys.all?(...)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # @see Enumerable#all?
5
5
  def all_values?(...)
6
6
  values.all?(...)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # @see Enumerable#any?
5
5
  def any_key?(...)
6
6
  keys.any?(...)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # @see Enumerable#any?
5
5
  def any_value?(...)
6
6
  values.any?(...)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Enumerable.class_eval do
3
+ module Enumerable
4
4
  # Joins the elements together after calling `compact_blank`
5
5
  #
6
6
  # @return [String]
@@ -3,7 +3,7 @@
3
3
  require 'forwardable'
4
4
  require 'set'
5
5
 
6
- Array.class_eval do
6
+ class Array
7
7
  # @return [Array]
8
8
  # Similar to `filter_map` but excludes `nil` instead of falsy
9
9
  def compact_map
@@ -18,7 +18,7 @@ Array.class_eval do
18
18
  end
19
19
  end
20
20
 
21
- Set.class_eval do
21
+ class Set
22
22
  extend Forwardable
23
23
 
24
24
  def_delegators :to_a, :compact_map
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- DateTime.class_eval do
5
+ class DateTime
6
6
  # :nodoc:
7
7
  def current_day
8
8
  beginning_of_day..end_of_day
@@ -2,14 +2,14 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- DateTime.class_eval do
5
+ class DateTime
6
6
  # :nodoc:
7
7
  def current_month
8
8
  beginning_of_month..end_of_month
9
9
  end
10
10
  end
11
11
 
12
- Date.class_eval do
12
+ class Date
13
13
  # :nodoc:
14
14
  def current_month
15
15
  beginning_of_month..end_of_month
@@ -2,14 +2,14 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- DateTime.class_eval do
5
+ class DateTime
6
6
  # @return Range<DateTime>
7
7
  def current_week
8
8
  beginning_of_week..end_of_week
9
9
  end
10
10
  end
11
11
 
12
- Date.class_eval do
12
+ class Date
13
13
  # @return Range<Date>
14
14
  def current_week
15
15
  beginning_of_week..end_of_week
@@ -4,7 +4,7 @@ require 'active_support/core_ext/object/blank'
4
4
  require 'active_support/core_ext/string/filters'
5
5
  require 'active_support/core_ext/string/output_safety'
6
6
 
7
- String.class_eval do
7
+ class String
8
8
  # Cuts off a long string and will add an ellipsis or
9
9
  # what has been entered via +:end_more+ option.
10
10
  #
@@ -2,14 +2,14 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- DateTime.class_eval do
5
+ class DateTime
6
6
  # @return [String] - Full day word
7
7
  def day_of_week
8
8
  strftime('%A')
9
9
  end
10
10
  end
11
11
 
12
- Date.class_eval do
12
+ class Date
13
13
  # @return [String] - Full day word
14
14
  def day_of_week
15
15
  strftime('%A')
@@ -2,14 +2,14 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- DateTime.class_eval do
5
+ class DateTime
6
6
  # @return [String]
7
7
  def display_military(all = false)
8
8
  strftime(all ? '%m/%d/%Y %T' : '%-m/%-d/%y %T')
9
9
  end
10
10
  end
11
11
 
12
- Time.class_eval do
12
+ class Time
13
13
  # @return [String]
14
14
  def display_military(all = false)
15
15
  to_datetime.display_military(all)
@@ -2,21 +2,21 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- DateTime.class_eval do
5
+ class DateTime
6
6
  # @return [String] - mm/dd/yyyy HH:MM:SS AM/PM or m/d/yy HH:MM:SS AM/PM
7
7
  def display_user(all = false)
8
8
  strftime(all ? '%m/%d/%Y %r' : '%-m/%-d/%y %r')
9
9
  end
10
10
  end
11
11
 
12
- Time.class_eval do
13
- # @return [String] - mm/dd/yyyy or m/d/yy
12
+ class Time
13
+ # @return [String] - mm/dd/yyyy HH:MM:SS AM/PM or m/d/yy HH:MM:SS AM/PM
14
14
  def display_user(all = false)
15
15
  to_datetime.display_user(all)
16
16
  end
17
17
  end
18
18
 
19
- Date.class_eval do
19
+ class Date
20
20
  # @return [String] - mm/dd/yyyy or m/d/yy
21
21
  def display_user(all = false)
22
22
  strftime(all ? '%m/%d/%Y' : '%-m/%-d/%y')
@@ -3,7 +3,7 @@
3
3
  require 'forwardable'
4
4
  require 'set'
5
5
 
6
- Array.class_eval do
6
+ class Array
7
7
  # :nodoc:
8
8
  def find!(&block)
9
9
  x = find(&block)
@@ -13,7 +13,7 @@ Array.class_eval do
13
13
  end
14
14
  end
15
15
 
16
- Set.class_eval do
16
+ class Set
17
17
  extend Forwardable
18
18
 
19
19
  def_delegators :to_a, :find!
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Array.class_eval do
3
+ class Array
4
4
  # @param threshold [Integer] default 1
5
5
  #
6
6
  # @return [Array] excluding items that appear more than `threshold` times
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Array.class_eval do
3
+ class Array
4
4
  # @param threshold [Integer] default 1
5
- # @return [*] first items that appears more than `threshold` times
5
+ # @return [Object, nil] first item that appears more than `threshold` times
6
6
  def first_dupe(threshold = 1)
7
7
  find { |item| count(item) > threshold }
8
8
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Array.class_eval do
3
+ class Array
4
4
  # Flattens and compacts an array
5
5
  # @see Array#flatten!
6
6
  # @see Array#compact!
@@ -15,5 +15,5 @@ Array.class_eval do
15
15
  self
16
16
  end
17
17
 
18
- alias_method :flat_pact!, :flatten_compact!
18
+ alias flat_pact! flatten_compact!
19
19
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- DateTime.class_eval do
5
+ class DateTime
6
6
  # @return [String] yyyy-mm-ddThh:mm:ss+hhmm
7
7
  def google_format
8
8
  strftime('%FT%T%z')
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # The opposite of +Hash.except+.
5
5
  # ~/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.5/lib/active_support/core_ext/hash/except.rb
6
6
  # https://apidock.com/rails/Hash/except
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'forwardable'
4
4
 
5
- Symbol.class_eval do
5
+ class Symbol
6
6
  extend Forwardable
7
7
 
8
8
  def_delegators :to_s, :humanize
@@ -2,14 +2,14 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- DateTime.class_eval do
5
+ class DateTime
6
6
  # @return [DateTime]
7
7
  def in_utc
8
- utc? ? self : in_time_zone('UTC').to_datetime
8
+ utc? ? self : new_offset(0)
9
9
  end
10
10
  end
11
11
 
12
- Time.class_eval do
12
+ class Time
13
13
  # @return [Time]
14
14
  def in_utc
15
15
  utc? ? self : in_time_zone('UTC')
@@ -2,14 +2,14 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- DateTime.class_eval do
5
+ class DateTime
6
6
  # @return [String] - yyyy-mm-dd[Thh:mm::ss]
7
7
  def input(all = false)
8
8
  strftime(all ? '%F %T' : '%F')
9
9
  end
10
10
  end
11
11
 
12
- Date.class_eval do
12
+ class Date
13
13
  # @return [String] - yyyy-mm-dd
14
14
  def input(_all = false)
15
15
  strftime('%F')
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # Invert a hash keeping possible duplicate values.
5
5
  # @see Hash#invert for more details or to use without keeping duplicates.
6
6
  # @see https://stackoverflow.com/a/10989394/8806642 for source.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # Do a deep merge, but don't override the key-value pairs on the left.
5
5
  #
6
6
  # @param other_hash [Hash]
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- Date.class_eval do
5
+ class Date
6
6
  # @return [String] - mm/yy
7
7
  def month_and_year
8
8
  strftime('%m/%y')
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'date'
4
4
 
5
- Date.class_eval do
5
+ class Date
6
6
  # @return [String] - yyyy-mm
7
7
  def month_year
8
8
  input[0, 7]
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # Does a typical merge, but this will remove blank values on the right side.
5
5
  #
6
6
  # @param other_hash [Hash]
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # @see Enumerable#none?
5
5
  def no_keys?(...)
6
6
  keys.none?(...)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Hash.class_eval do
3
+ class Hash
4
4
  # @see Enumerable#none?
5
5
  def no_values?(...)
6
6
  values.none?(...)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Array.class_eval do
3
+ class Array
4
4
  # Same as `my_array.any?(&block) && !my_array.all?(&block)`
5
5
  #
6
6
  # @return [Boolean]
@@ -3,14 +3,14 @@
3
3
  require 'forwardable'
4
4
  require 'set'
5
5
 
6
- Array.class_eval do
6
+ class Array
7
7
  # @return [Boolean]
8
8
  def overlaps?(other)
9
9
  !(self & Array(other)).empty?
10
10
  end
11
11
  end
12
12
 
13
- Set.class_eval do
13
+ class Set
14
14
  extend Forwardable
15
15
 
16
16
  def_delegators :to_a, :overlaps?
@@ -3,7 +3,7 @@
3
3
  require 'forwardable'
4
4
  require 'set'
5
5
 
6
- Array.class_eval do
6
+ class Array
7
7
  # Replace my_array.map(&:method1).map(&:method2) with my_array.pipe(:method1, :method2)
8
8
  # @return [Array]
9
9
  def pipe(*fns)
@@ -11,7 +11,7 @@ Array.class_eval do
11
11
  end
12
12
  end
13
13
 
14
- Set.class_eval do
14
+ class Set
15
15
  extend Forwardable
16
16
 
17
17
  def_delegators :to_a, :pipe
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Object.class_eval do
3
+ class Object
4
4
  # Returns self if `present?`
5
5
  #
6
6
  # @raise [BlankObject] if `blank?`
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- String.class_eval do
3
+ class String
4
4
  # Return the quarter start date.
5
5
  #
6
6
  # @return [Date]
@@ -14,14 +14,16 @@ module QuarterStrMethods
14
14
  end
15
15
  end
16
16
 
17
- DateTime.class_eval do
17
+ class DateTime
18
18
  include QuarterStrMethods
19
19
  end
20
20
 
21
- Time.class_eval do
21
+ class Time
22
22
  include QuarterStrMethods
23
23
  end
24
24
 
25
- ActiveSupport::TimeWithZone.class_eval do
26
- include QuarterStrMethods
25
+ module ActiveSupport
26
+ class TimeWithZone
27
+ include QuarterStrMethods
28
+ end
27
29
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Range.class_eval do
3
+ class Range
4
4
  # Allows adding a to a range. This will create a new range since ranges are immutable.
5
5
  #
6
6
  # @note Make sure to assign this to a new var or inline replacement `+=`.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Range.class_eval do
3
+ class Range
4
4
  # Greater than check.
5
5
  #
6
6
  # @param other [Numeric]
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Range.class_eval do
3
+ class Range
4
4
  # Allows multiplying a range. This will create a new range due to range objects being immutable.
5
5
  #
6
6
  # @note Make sure to assign this to a new var or do inline replacement `*=`.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Range.class_eval do
3
+ class Range
4
4
  # Rounds a range. Rounds the beginning and ending values only
5
5
  # and creates a new range with the rounded values.
6
6
  #
@@ -1,26 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  if defined?(ActiveJob::Base)
4
- ActiveJob::Base.class_eval do
5
- # Removes any reserved keywords that can't be passed along.
6
- #
7
- # @param arguments [...]
8
- #
9
- # @return [String, Numeric, Hash, Array, nil]
10
- #
11
- def remove_reserved_keywords(arguments)
12
- case arguments
13
- when String, Numeric
14
- arguments
15
- when Hash
16
- arguments.each_with_object({}) do |(key, value), obj|
17
- next if key.start_with?('_aj')
4
+ module ActiveJob
5
+ class Base
6
+ # Removes any reserved keywords that can't be passed along.
7
+ #
8
+ # @param arguments [...]
9
+ #
10
+ # @return [String, Numeric, Hash, Array, nil]
11
+ #
12
+ def remove_reserved_keywords(arguments)
13
+ case arguments
14
+ when String, Numeric
15
+ arguments
16
+ when Hash
17
+ arguments.each_with_object({}) do |(key, value), obj|
18
+ next if key.start_with?('_aj')
18
19
 
19
- obj[key] = remove_reserved_keywords(value)
20
- end
21
- when Array
22
- arguments.map do |arg|
23
- remove_reserved_keywords(arg)
20
+ obj[key] = remove_reserved_keywords(value)
21
+ end
22
+ when Array
23
+ arguments.map do |arg|
24
+ remove_reserved_keywords(arg)
25
+ end
24
26
  end
25
27
  end
26
28
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Time.class_eval do
3
+ class Time
4
4
  class << self
5
5
  # Parses the `str` and returns `nil` if invalid
6
6
  def safe_parse(str)
@@ -11,20 +11,7 @@ Time.class_eval do
11
11
  end
12
12
  end
13
13
 
14
- if defined?(ActiveSupport::TimeZone)
15
- ActiveSupport::TimeZone.class_eval do
16
- class << self
17
- # Parses the `str` and returns `nil` if invalid
18
- def safe_parse(str)
19
- parse(str)
20
- rescue
21
- nil
22
- end
23
- end
24
- end
25
- end
26
-
27
- Date.class_eval do
14
+ class Date
28
15
  class << self
29
16
  # Parses the `str` and returns `nil` if invalid
30
17
  def safe_parse(str)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Enumerable.class_eval do
3
+ module Enumerable
4
4
  # @see `compact_blank`
5
5
  def select_present(...)
6
6
  compact_blank(...)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Enumerable.class_eval do
3
+ module Enumerable
4
4
  # @see `compact_blank_join`
5
5
  def select_present_join(...)
6
6
  compact_blank_join(...)
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'forwardable'
4
4
 
5
- Set.class_eval do
5
+ class Set
6
6
  extend Forwardable
7
7
 
8
8
  def_delegators :to_a, :to_sentence