Class: String
Instance Method Summary collapse
Instance Method Details
#indices_of_pattern(pattern) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/extensions/string.rb', line 2 def indices_of_pattern(pattern) indices = [] split("").each_with_index do |_, idx| if self[idx..-1].start_with?(pattern) indices << idx end end indices end |