提交 cfaaed3f 编写于 作者: N Norman Clarke 提交者: José Valim

Move some methods into 1.8.x-only proxy. [#4978 state:resolved]

These methods had been overridden because they had bugs on 1.9.1.  Since
Rails now supports only 1.9.2, and these methods now work properly on
that version, there's no longer any need to override them.
Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 9a6fc9a5
......@@ -195,6 +195,45 @@ def ord
Unicode.u_unpack(@wrapped_string)[0]
end
# Works just like <tt>String#rjust</tt>, only integer specifies characters instead of bytes.
#
# Example:
#
# "¾ cup".mb_chars.rjust(8).to_s
# #=> " ¾ cup"
#
# "¾ cup".mb_chars.rjust(8, " ").to_s # Use non-breaking whitespace
# #=> "   ¾ cup"
def rjust(integer, padstr=' ')
justify(integer, :right, padstr)
end
# Works just like <tt>String#ljust</tt>, only integer specifies characters instead of bytes.
#
# Example:
#
# "¾ cup".mb_chars.rjust(8).to_s
# #=> "¾ cup "
#
# "¾ cup".mb_chars.rjust(8, " ").to_s # Use non-breaking whitespace
# #=> "¾ cup   "
def ljust(integer, padstr=' ')
justify(integer, :left, padstr)
end
# Works just like <tt>String#center</tt>, only integer specifies characters instead of bytes.
#
# Example:
#
# "¾ cup".mb_chars.center(8).to_s
# #=> " ¾ cup "
#
# "¾ cup".mb_chars.center(8, " ").to_s # Use non-breaking whitespace
# #=> " ¾ cup  "
def center(integer, padstr=' ')
justify(integer, :center, padstr)
end
else
def =~(other)
@wrapped_string =~ other
......@@ -250,46 +289,6 @@ def []=(*args)
end
end
# Works just like <tt>String#rjust</tt>, only integer specifies characters instead of bytes.
#
# Example:
#
# "¾ cup".mb_chars.rjust(8).to_s
# #=> " ¾ cup"
#
# "¾ cup".mb_chars.rjust(8, " ").to_s # Use non-breaking whitespace
# #=> "   ¾ cup"
def rjust(integer, padstr=' ')
justify(integer, :right, padstr)
end
# Works just like <tt>String#ljust</tt>, only integer specifies characters instead of bytes.
#
# Example:
#
# "¾ cup".mb_chars.rjust(8).to_s
# #=> "¾ cup "
#
# "¾ cup".mb_chars.rjust(8, " ").to_s # Use non-breaking whitespace
# #=> "¾ cup   "
def ljust(integer, padstr=' ')
justify(integer, :left, padstr)
end
# Works just like <tt>String#center</tt>, only integer specifies characters instead of bytes.
#
# Example:
#
# "¾ cup".mb_chars.center(8).to_s
# #=> " ¾ cup "
#
# "¾ cup".mb_chars.center(8, " ").to_s # Use non-breaking whitespace
# #=> " ¾ cup  "
def center(integer, padstr=' ')
justify(integer, :center, padstr)
end
# Reverses all characters in the string.
#
# Example:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册