Method: ActiveSupport::Multibyte::Chars#split

Defined in:
activesupport/lib/active_support/multibyte/chars.rb

#split(*args) ⇒ Object

Works just like String#split, with the exception that the items in the resulting list are Chars instances instead of String. This makes chaining methods easier.

'Café périferôl'.mb_chars.split(/é/).map { |part| part.upcase.to_s } # => ["CAF", " P", "RIFERÔL"]


83
84
85
# File 'activesupport/lib/active_support/multibyte/chars.rb', line 83

def split(*args)
  @wrapped_string.split(*args).map { |i| self.class.new(i) }
end