From c4b522d3c89208b554780e9c49747d07dbe3a4e5 Mon Sep 17 00:00:00 2001 From: Norman Clarke Date: Thu, 5 Jan 2012 11:51:10 -0300 Subject: Make return value from bang methods match Ruby docs The docs for the String class indicate that methods like `rstrip!` and others should return nil when they do not have an effect on the string. --- activesupport/lib/active_support/multibyte/chars.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index 9ca977012c..027aadb029 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -47,8 +47,8 @@ module ActiveSupport #:nodoc: # Forward all undefined methods to the wrapped string. def method_missing(method, *args, &block) if method.to_s =~ /!$/ - @wrapped_string.__send__(method, *args, &block) - self + result = @wrapped_string.__send__(method, *args, &block) + self if result else result = @wrapped_string.__send__(method, *args, &block) result.kind_of?(String) ? chars(result) : result -- cgit v1.2.3