Sha256: 43dd1529b97ed8230da2a750c59c16449a21814963c7b5bd705a786ff911034c

Contents?: true

Size: 907 Bytes

Versions: 14

Compression:

Stored size: 907 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Methods that calculate and return `Parser::Source::Ranges`.
    # @api private
    module ArgumentRangeHelper
      include RangeHelp

      private

      def first_argument_range(node)
        first_argument = node.first_argument

        range_between(first_argument.source_range.begin_pos, first_argument.source_range.end_pos)
      end

      def first_and_second_arguments_range(node)
        first_argument = node.first_argument
        second_argument = node.arguments[1]

        range_between(first_argument.source_range.begin_pos, second_argument.source_range.end_pos)
      end

      def all_arguments_range(node)
        first_argument = node.first_argument
        last_argument = node.arguments.last

        range_between(first_argument.source_range.begin_pos, last_argument.source_range.end_pos)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rubocop-minitest-0.29.0 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.28.0 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.27.0 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.26.1 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.26.0 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.25.1 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.25.0 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.24.0 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.23.2 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.23.1 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.23.0 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.22.2 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.22.1 lib/rubocop/cop/mixin/argument_range_helper.rb
rubocop-minitest-0.22.0 lib/rubocop/cop/mixin/argument_range_helper.rb