Method: Regexp::MatchLength#each
- Defined in:
- lib/regexp_parser/expression/methods/match_length.rb
#each(opts = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/regexp_parser/expression/methods/match_length.rb', line 24 def each(opts = {}) return enum_for(__method__, opts) unless block_given? limit = opts[:limit] || 1000 yielded = 0 (min..max).each do |num| next unless include?(num) yield(num) break if (yielded += 1) >= limit end end |