Sha256: 0403a7866246670c032c4240f4963b5749e70bd41c7be5677e9327067d9673af

Contents?: true

Size: 495 Bytes

Versions: 100

Compression:

Stored size: 495 Bytes

Contents

require 'strscan'

module ActiveSupport #:nodoc:
  module CoreExtensions #:nodoc:
    module String #:nodoc:
      # Custom string iterators
      module Iterators
        # Yields a single-character string for each character in the string.
        # When $KCODE = 'UTF8', multi-byte characters are yielded appropriately.
        def each_char
          scanner, char = StringScanner.new(self), /./mu
          loop { yield(scanner.scan(char) || break) }
        end
      end
    end
  end
end

Version data entries

100 entries across 100 versions & 8 rubygems

Version Path
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
activesupport-1.3.1 lib/active_support/core_ext/string/iterators.rb
activesupport-1.4.1 lib/active_support/core_ext/string/iterators.rb
activesupport-1.3.0 lib/active_support/core_ext/string/iterators.rb
activesupport-1.4.2 lib/active_support/core_ext/string/iterators.rb
activesupport-2.0.0 lib/active_support/core_ext/string/iterators.rb
activesupport-1.4.3 lib/active_support/core_ext/string/iterators.rb
activesupport-1.4.0 lib/active_support/core_ext/string/iterators.rb
activesupport-1.4.4 lib/active_support/core_ext/string/iterators.rb
activesupport-2.0.1 lib/active_support/core_ext/string/iterators.rb
activesupport-2.0.2 lib/active_support/core_ext/string/iterators.rb
activesupport-2.0.4 lib/active_support/core_ext/string/iterators.rb
activesupport-2.0.5 lib/active_support/core_ext/string/iterators.rb