Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ole/support.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#indexes(string) ⇒ Object

plural of String#index. returns all offsets of string. rename to indices?

note that it doesn’t check for overlapping values.



15
16
17
18
# File 'lib/ole/support.rb', line 15

def indexes string
	# in some ways i'm surprised that $~ works properly in this case...
	to_enum(:scan, /#{Regexp.quote string}/m).map { $~.begin 0 }
end