Method: Chars::CharSet#each_substring

Defined in:
lib/chars/char_set.rb

#each_substring(data, **kwargs) ⇒ Enumerator

Enumerates over all substrings within the given string, of minimum length and that are made up of characters from the Chars::CharSet.

Parameters:

Options Hash (**kwargs):

  • :min_length (Integer)

    The minimum length of sub-strings found within the given data.

Returns:

  • (Enumerator)

    If no block is given, an Enumerator object will be returned.

See Also:

Since:

  • 0.3.0



507
508
509
510
511
512
513
# File 'lib/chars/char_set.rb', line 507

def each_substring(data,**kwargs)
  return enum_for(__method__,data,**kwargs) unless block_given?

  each_substring_with_index(data,**kwargs) do |substring,index|
    yield substring
  end
end