aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-06-30 15:01:23 +0200
committerJosé Valim <jose.valim@gmail.com>2010-06-30 15:01:23 +0200
commit9ab8cfc21ab07b9a65388ce3643e5558642dbc2a (patch)
tree17dfd85321420f1c35bd1e9c553a4718a577e38e /activesupport
parent265b7c5edfe9b60d1ab547bfef569d94df05b8e9 (diff)
downloadrails-9ab8cfc21ab07b9a65388ce3643e5558642dbc2a.tar.gz
rails-9ab8cfc21ab07b9a65388ce3643e5558642dbc2a.tar.bz2
rails-9ab8cfc21ab07b9a65388ce3643e5558642dbc2a.zip
Improve the idiom used in multibyte chars a bit.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/multibyte/chars.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb
index 9251b26f62..8823e4a5ed 100644
--- a/activesupport/lib/active_support/multibyte/chars.rb
+++ b/activesupport/lib/active_support/multibyte/chars.rb
@@ -316,12 +316,12 @@ module ActiveSupport #:nodoc:
result = @wrapped_string.slice(*args)
elsif args.size == 1 && args[0].kind_of?(Numeric)
character = Unicode.u_unpack(@wrapped_string)[args[0]]
- result = character.nil? ? nil : [character].pack('U')
+ result = character && [character].pack('U')
else
cps = Unicode.u_unpack(@wrapped_string).slice(*args)
- result = cps.nil? ? nil : cps.pack('U*')
+ result = cps && cps.pack('U*')
end
- result.nil? ? nil : chars(result)
+ result && chars(result)
end
alias_method :[], :slice