aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/multibyte
diff options
context:
space:
mode:
authorNorman Clarke <norman@njclarke.com>2010-06-25 23:55:25 -0300
committerJosé Valim <jose.valim@gmail.com>2010-06-26 10:16:37 +0200
commitcfaaed3f40e820d2b4d60c2d8bc1f9a005cee086 (patch)
treefe4ef434ddde57761dcb4bf3b7ff21bef55142d8 /activesupport/lib/active_support/multibyte
parent9a6fc9a540cd23af3ca061cb7406a6cdd5ad4294 (diff)
downloadrails-cfaaed3f40e820d2b4d60c2d8bc1f9a005cee086.tar.gz
rails-cfaaed3f40e820d2b4d60c2d8bc1f9a005cee086.tar.bz2
rails-cfaaed3f40e820d2b4d60c2d8bc1f9a005cee086.zip
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>
Diffstat (limited to 'activesupport/lib/active_support/multibyte')
-rw-r--r--activesupport/lib/active_support/multibyte/chars.rb79
1 files changed, 39 insertions, 40 deletions
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb
index 04193bfa65..c107aad6bb 100644
--- a/activesupport/lib/active_support/multibyte/chars.rb
+++ b/activesupport/lib/active_support/multibyte/chars.rb
@@ -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: