mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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: José Valim <jose.valim@gmail.com>
This commit is contained in:
committed by
José Valim
parent
9a6fc9a540
commit
cfaaed3f40
@@ -195,6 +195,45 @@ module ActiveSupport #:nodoc:
|
||||
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 @@ module ActiveSupport #:nodoc:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user