/usr/lib/ruby/vendor_ruby/active_support/core_ext/string/iterators.rb is in ruby-activesupport-2.3 2.3.14-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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
|