Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/ole/support.rb
Overview
:nodoc:
Direct Known Subclasses
Ole::Types::Clsid, Ole::Types::Data, Ole::Types::Lpstr, Ole::Types::Lpwstr
Instance Method Summary collapse
- #each_chunk(size) ⇒ Object
-
#indexes(string) ⇒ Object
plural of String#index.
Instance Method Details
#each_chunk(size) ⇒ Object
20 21 22 |
# File 'lib/ole/support.rb', line 20 def each_chunk size (length / size.to_f).ceil.times { |i| yield self[i * size, size] } end |
#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 |