Module ActiveSupport::CoreExtensions::String::Iterators
In: vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb

Custom string iterators

Methods

Public Class methods

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb, line 8
 8:         def self.append_features(base)
 9:           super unless '1.9'.respond_to?(:each_char)
10:         end

Public Instance methods

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

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb, line 14
14:         def each_char
15:           scanner, char = StringScanner.new(self), /./mu
16:           while c = scanner.scan(char)
17:             yield c
18:           end
19:         end

[Validate]