From d0d25a9317aaea794f30e067e9388fe4e08bcde5 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 16 Aug 2011 10:49:20 -0700 Subject: prefer ends_with? over slicing --- activesupport/lib/active_support/core_ext/module/delegation.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext') 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) -- cgit v1.2.3