diff options
author | Norman Clarke <norman@njclarke.com> | 2012-01-05 11:51:10 -0300 |
---|---|---|
committer | Norman Clarke <norman@njclarke.com> | 2012-01-05 11:51:10 -0300 |
commit | c4b522d3c89208b554780e9c49747d07dbe3a4e5 (patch) | |
tree | ed27c524b219064e1696db64187f3dbc396c6151 /activesupport/lib/active_support/multibyte | |
parent | 4387f9724273ee477ff60876b360d0abcee0e344 (diff) | |
download | rails-c4b522d3c89208b554780e9c49747d07dbe3a4e5.tar.gz rails-c4b522d3c89208b554780e9c49747d07dbe3a4e5.tar.bz2 rails-c4b522d3c89208b554780e9c49747d07dbe3a4e5.zip |
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.
Diffstat (limited to 'activesupport/lib/active_support/multibyte')
-rw-r--r-- | activesupport/lib/active_support/multibyte/chars.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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 |