Class/Module Index [+]

Quicksearch

ActiveSupport::CoreExtensions::String::Iterators

Custom string iterators

Public Class Methods

append_features(base) click to toggle source
# File lib/active_support/core_ext/string/iterators.rb, line 8
def self.append_features(base)
  super unless '1.9'.respond_to?(:each_char)
end

Public Instance Methods

each_char() click to toggle source

Yields a single-character string for each character in the string. When $KCODE = 'UTF8', multi-byte characters are yielded appropriately.

# File lib/active_support/core_ext/string/iterators.rb, line 14
def each_char
  scanner, char = StringScanner.new(self), /./u
  while c = scanner.scan(char)
    yield c
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.