aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-08-16 10:49:20 -0700
committerXavier Noria <fxn@hashref.com>2011-08-16 10:49:20 -0700
commitd0d25a9317aaea794f30e067e9388fe4e08bcde5 (patch)
tree97388b887ec16aa2fdd97310940d0fbf41a9023b /activesupport
parent53a13083ecc7f99ff04d3fe54f8cb1d68e486aac (diff)
downloadrails-d0d25a9317aaea794f30e067e9388fe4e08bcde5.tar.gz
rails-d0d25a9317aaea794f30e067e9388fe4e08bcde5.tar.bz2
rails-d0d25a9317aaea794f30e067e9388fe4e08bcde5.zip
prefer ends_with? over slicing
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb
index 4a899a7d84..8350753f78 100644
--- a/activesupport/lib/active_support/core_ext/module/delegation.rb
+++ b/activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/object/public_send'
+require 'active_support/core_ext/string/starts_ends_with'
class Module
# Provides a delegate class method to easily expose contained objects' methods
@@ -126,7 +127,7 @@ class Module
methods.each do |method|
method = method.to_s
- call = (method[-1..-1] == '=') ? "public_send(:#{method}, " : "#{method}("
+ call = method.ends_with?('=') ? "public_send(:#{method}, " : "#{method}("
if allow_nil
module_eval(<<-EOS, file, line - 2)