diff --git a/activesupport/lib/active_support/core_ext/range/overlap.rb b/activesupport/lib/active_support/core_ext/range/overlap.rb index 07215776a7..b08cdb39cf 100644 --- a/activesupport/lib/active_support/core_ext/range/overlap.rb +++ b/activesupport/lib/active_support/core_ext/range/overlap.rb @@ -4,7 +4,7 @@ class Range # Compare two ranges and see if they overlap each other # (1..5).overlap?(4..6) # => true # (1..5).overlap?(7..9) # => false - unless Range.method_defined?(:overlap?) + unless Range.method_defined?(:overlap?) # Ruby 3.3+ def overlap?(other) raise TypeError unless other.is_a? Range diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 1176c5a5e7..67973f7f43 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -108,12 +108,6 @@ def sec_fraction subsec end - unless Time.method_defined?(:floor) - def floor(precision = 0) - change(nsec: 0) + subsec.floor(precision) - end - end - # Returns a new Time where one or more of the elements have been changed according # to the +options+ parameter. The time options (:hour, :min, # :sec, :usec, :nsec) reset cascadingly, so if only diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index 1b1af67115..521cdf6a43 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -392,14 +392,8 @@ def to_proc end private - if Symbol.method_defined?(:name) - def convert_key(key) - key.kind_of?(Symbol) ? key.name : key - end - else - def convert_key(key) - key.kind_of?(Symbol) ? key.to_s : key - end + def convert_key(key) + key.kind_of?(Symbol) ? key.name : key end def convert_value(value, conversion: nil) diff --git a/railties/lib/rails/command.rb b/railties/lib/rails/command.rb index f84d2feeca..92dcf6a125 100644 --- a/railties/lib/rails/command.rb +++ b/railties/lib/rails/command.rb @@ -23,7 +23,7 @@ def initialize(message, name, alternatives) super(message) end - if !Exception.method_defined?(:detailed_message) + if !Exception.method_defined?(:detailed_message) # Ruby 3.2+ def detailed_message(...) message end