diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
3 files changed, 8 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_time/conversions.rb b/activesupport/lib/active_support/core_ext/date_time/conversions.rb index 19925198c0..13d659f52a 100644 --- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb +++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb @@ -39,7 +39,7 @@ class DateTime to_default_s end end - alias_method :to_default_s, :to_s unless (instance_methods(false) & [:to_s, 'to_s']).empty? + alias_method :to_default_s, :to_s if instance_methods(false).include?(:to_s) alias_method :to_s, :to_formatted_s # diff --git a/activesupport/lib/active_support/core_ext/load_error.rb b/activesupport/lib/active_support/core_ext/load_error.rb index 8bdfa0c5bc..fe24f3716d 100644 --- a/activesupport/lib/active_support/core_ext/load_error.rb +++ b/activesupport/lib/active_support/core_ext/load_error.rb @@ -6,12 +6,14 @@ class LoadError /^cannot load such file -- (.+)$/i, ] - def path - @path ||= begin - REGEXPS.find do |regex| - message =~ regex + unless method_defined?(:path) + def path + @path ||= begin + REGEXPS.find do |regex| + message =~ regex + end + $1 end - $1 end end diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index fbef27c76a..39a1240c61 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -107,7 +107,6 @@ class Module raise ArgumentError, 'Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter).' end - to = to.to_s prefix, allow_nil = options.values_at(:prefix, :allow_nil) if prefix == true && to =~ /^[^a-z_]/ @@ -125,8 +124,6 @@ class Module line = line.to_i methods.each do |method| - method = method.to_s - # Attribute writer methods only accept one argument. Makes sure []= # methods still accept two arguments. definition = (method =~ /[^\]]=$/) ? 'arg' : '*args, &block' |