Skip to content

Commit f6723ce

Browse files
authored
Merge pull request rails#28040 from kenta-s/fix-doc-in-multibyte-chars
Fix doc in Multibyte::Chars [ci skip]
2 parents 6dcccee + 6428808 commit f6723ce

File tree

1 file changed

+5
-4
lines changed
  • activesupport/lib/active_support/multibyte

1 file changed

+5
-4
lines changed

activesupport/lib/active_support/multibyte/chars.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ module Multibyte #:nodoc:
1616
# through the +mb_chars+ method. Methods which would normally return a
1717
# String object now return a Chars object so methods can be chained.
1818
#
19-
# 'The Perfect String '.mb_chars.downcase.strip.normalize # => "the perfect string"
19+
# 'The Perfect String '.mb_chars.downcase.strip.normalize
20+
# # => #<ActiveSupport::Multibyte::Chars:0x007fdc434ccc10 @wrapped_string="the perfect string">
2021
#
2122
# Chars objects are perfectly interchangeable with String objects as long as
2223
# no explicit class checks are made. If certain methods do explicitly check
@@ -134,7 +135,7 @@ def downcase
134135

135136
# Converts characters in the string to the opposite case.
136137
#
137-
# 'El Cañón".mb_chars.swapcase.to_s # => "eL cAÑÓN"
138+
# 'El Cañón'.mb_chars.swapcase.to_s # => "eL cAÑÓN"
138139
def swapcase
139140
chars Unicode.swapcase(@wrapped_string)
140141
end
@@ -148,8 +149,8 @@ def capitalize
148149

149150
# Capitalizes the first letter of every word, when possible.
150151
#
151-
# "ÉL QUE SE ENTERÓ".mb_chars.titleize # => "Él Que Se Enteró"
152-
# "日本語".mb_chars.titleize # => "日本語"
152+
# "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró"
153+
# "日本語".mb_chars.titleize.to_s # => "日本語"
153154
def titleize
154155
chars(downcase.to_s.gsub(/\b('?\S)/u) { Unicode.upcase($1) })
155156
end

0 commit comments

Comments
 (0)