Sha256: 4da173055bd1ccd62df33d2e001eb2be4232ed998eb56801ed9d6518945c1f85

Contents?: true

Size: 776 Bytes

Versions: 134

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module AST
    module Ext
      # Extensions to Parser::AST::Range
      module Range
        # @return [Range] the range of line numbers for the node
        # If `exclude_end` is `true`, then the range will be exclusive.
        #
        # Assume that `node` corresponds to the following array literal:
        #
        #   [
        #     :foo,
        #     :bar
        #   ]
        #
        #   node.loc.begin.line_span                       # => 1..1
        #   node.source_range.line_span(exclude_end: true) # => 1...4
        def line_span(exclude_end: false)
          ::Range.new(first_line, last_line, exclude_end)
        end
      end
    end
  end
end

Parser::Source::Range.include RuboCop::AST::Ext::Range

Version data entries

134 entries across 134 versions & 18 rubygems

Version Path
rubocop-ast-1.41.0 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.40.0 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.39.0 lib/rubocop/ast/ext/range.rb
siteimprove_api_client-1.0.1 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.38.1/lib/rubocop/ast/ext/range.rb
rubocop-ast-1.38.1 lib/rubocop/ast/ext/range.rb
tailscale_middleware-0.0.3 vendor/cache/ruby/3.4.0/gems/rubocop-ast-1.38.0/lib/rubocop/ast/ext/range.rb
rubocop-ast-1.38.0 lib/rubocop/ast/ext/range.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/ext/range.rb
rubocop-ast-1.37.0 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.36.2 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.36.1 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.36.0 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.35.0 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.34.1 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.34.0 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.33.1 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.33.0 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.32.3 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.32.2 lib/rubocop/ast/ext/range.rb
rubocop-ast-1.32.1 lib/rubocop/ast/ext/range.rb