vendor/rails/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb in radiant-0.6.9 vs vendor/rails/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb in radiant-0.7.0

- old
+ new

@@ -145,17 +145,15 @@ # # Example: # # s = "Müller" # s.chars[2] = "e" # Replace character with offset 2 - # s - # #=> "Müeler" + # s # => "Müeler" # # s = "Müller" # s.chars[1, 2] = "ö" # Replace 2 characters at character offset 1 - # s - # #=> "Möler" + # s # => "Möler" def []=(str, *args) replace_by = args.pop # Indexed replace with regular expressions already works return str[*args] = replace_by if args.first.is_a?(Regexp) result = u_unpack(str) @@ -181,40 +179,40 @@ # Works just like String#rjust, only integer specifies characters instead of bytes. # # Example: # # "¾ cup".chars.rjust(8).to_s - # #=> " ¾ cup" + # # => " ¾ cup" # # "¾ cup".chars.rjust(8, " ").to_s # Use non-breaking whitespace - # #=> "   ¾ cup" + # # => "   ¾ cup" def rjust(str, integer, padstr=' ') justify(str, integer, :right, padstr) end # Works just like String#ljust, only integer specifies characters instead of bytes. # # Example: # # "¾ cup".chars.rjust(8).to_s - # #=> "¾ cup " + # # => "¾ cup " # # "¾ cup".chars.rjust(8, " ").to_s # Use non-breaking whitespace - # #=> "¾ cup   " + # # => "¾ cup   " def ljust(str, integer, padstr=' ') justify(str, integer, :left, padstr) end # Works just like String#center, only integer specifies characters instead of bytes. # # Example: # # "¾ cup".chars.center(8).to_s - # #=> " ¾ cup " + # # => " ¾ cup " # # "¾ cup".chars.center(8, " ").to_s # Use non-breaking whitespace - # #=> " ¾ cup  " + # # => " ¾ cup  " def center(str, integer, padstr=' ') justify(str, integer, :center, padstr) end # Does Unicode-aware rstrip @@ -282,10 +280,12 @@ # Returns the KC normalization of the string by default. NFKC is considered the best normalization form for # passing strings to databases and validations. # # * <tt>str</tt> - The string to perform normalization on. - # * <tt>form</tt> - The form you want to normalize in. Should be one of the following: :c, :kc, :d or :kd. + # * <tt>form</tt> - The form you want to normalize in. Should be one of the following: + # <tt>:c</tt>, <tt>:kc</tt>, <tt>:d</tt>, or <tt>:kd</tt>. Default is + # ActiveSupport::Multibyte::DEFAULT_NORMALIZATION_FORM. def normalize(str, form=ActiveSupport::Multibyte::DEFAULT_NORMALIZATION_FORM) # See http://www.unicode.org/reports/tr15, Table 1 codepoints = u_unpack(str) case form when :d