aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-06-06 08:49:38 -0700
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-06-06 08:49:38 -0700
commitb4fb80cbdab118125df0d48e74b6818fe5ec65d5 (patch)
treeb912b5041ee4a6a1ea7fdb3a743a7205b6bbd579 /activesupport/lib/active_support
parent96123978ff5cbfe1ce56c2a3203b02007823335b (diff)
parentef9bbb87e8228940f768580a7d05d5feadec0d1e (diff)
downloadrails-b4fb80cbdab118125df0d48e74b6818fe5ec65d5.tar.gz
rails-b4fb80cbdab118125df0d48e74b6818fe5ec65d5.tar.bz2
rails-b4fb80cbdab118125df0d48e74b6818fe5ec65d5.zip
Merge pull request #6645 from amatsuda/reduce_string_instance
Reduce number of String instance
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/conversions.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb3
-rw-r--r--activesupport/lib/active_support/log_subscriber.rb4
-rw-r--r--activesupport/lib/active_support/xml_mini.rb2
4 files changed, 4 insertions, 7 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/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'
diff --git a/activesupport/lib/active_support/log_subscriber.rb b/activesupport/lib/active_support/log_subscriber.rb
index d2a6e1bd82..bea2ca17f1 100644
--- a/activesupport/lib/active_support/log_subscriber.rb
+++ b/activesupport/lib/active_support/log_subscriber.rb
@@ -61,7 +61,7 @@ module ActiveSupport
@@flushable_loggers = nil
log_subscriber.public_methods(false).each do |event|
- next if 'call' == event.to_s
+ next if :call == event
notifier.subscribe("#{event}.#{namespace}", log_subscriber)
end
@@ -114,7 +114,7 @@ module ActiveSupport
#
def color(text, color, bold=false)
return text unless colorize_logging
- color = self.class.const_get(color.to_s.upcase) if color.is_a?(Symbol)
+ color = self.class.const_get(color.upcase) if color.is_a?(Symbol)
bold = bold ? BOLD : ""
"#{bold}#{color}#{text}#{CLEAR}"
end
diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb
index 88e18f6fff..88f9acb588 100644
--- a/activesupport/lib/active_support/xml_mini.rb
+++ b/activesupport/lib/active_support/xml_mini.rb
@@ -83,7 +83,7 @@ module ActiveSupport
if name.is_a?(Module)
@backend = name
else
- require "active_support/xml_mini/#{name.to_s.downcase}"
+ require "active_support/xml_mini/#{name.downcase}"
@backend = ActiveSupport.const_get("XmlMini_#{name}")
end
end