instiki/vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
Jacques Distler 4e14ccc74d Instiki 0.16.3: Rails 2.3.0
Instiki now runs on the Rails 2.3.0 Candidate Release.
Among other improvements, this means that it now 
automagically selects between WEBrick and Mongrel.

Just run

    ./instiki --daemon
2009-02-04 14:26:08 -06:00

24 lines
619 B
Ruby

require 'strscan'
module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module String #:nodoc:
# Custom string iterators
module Iterators
def self.append_features(base)
super unless '1.9'.respond_to?(:each_char)
end
# 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
while c = scanner.scan(char)
yield c
end
end
end
end
end
end