Sha256: 1e01ae7887f3778e137189a8a2a5896956780dd472760f0a84f3a3b9212b9b79

Contents?: true

Size: 721 Bytes

Versions: 6886

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Common functionality for obtaining source ranges from regexp matches
    module MatchRange
      include RangeHelp

      private

      # Return a new `Range` covering the first matching group number for each
      # match of `regex` inside `range`
      def each_match_range(range, regex)
        range.source.scan(regex) do
          yield match_range(range, Regexp.last_match)
        end
      end

      # For a `match` inside `range`, return a new `Range` covering the match
      def match_range(range, match)
        range_between(range.begin_pos + match.begin(1),
                      range.begin_pos + match.end(1))
      end
    end
  end
end

Version data entries

6,886 entries across 6,860 versions & 30 rubygems

Version Path
cybrid_api_bank_ruby-0.123.111 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_organization_ruby-0.123.111 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_id_ruby-0.123.111 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_id_ruby-0.123.110 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_bank_ruby-0.123.110 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_organization_ruby-0.123.110 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_bank_ruby-0.123.109 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_organization_ruby-0.123.109 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_id_ruby-0.123.109 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_bank_ruby-0.123.107 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_organization_ruby-0.123.107 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_id_ruby-0.123.107 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_bank_ruby-0.123.106 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_organization_ruby-0.123.106 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_id_ruby-0.123.106 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_organization_ruby-0.123.105 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_bank_ruby-0.123.105 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_id_ruby-0.123.105 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_bank_ruby-0.123.104 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb
cybrid_api_id_ruby-0.123.104 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/match_range.rb