aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/multibyte
diff options
context:
space:
mode:
authorNorman Clarke <norman@njclarke.com>2012-01-05 11:51:10 -0300
committerNorman Clarke <norman@njclarke.com>2012-01-05 11:51:10 -0300
commitc4b522d3c89208b554780e9c49747d07dbe3a4e5 (patch)
treeed27c524b219064e1696db64187f3dbc396c6151 /activesupport/lib/active_support/multibyte
parent4387f9724273ee477ff60876b360d0abcee0e344 (diff)
downloadrails-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.rb4
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