Sha256: cd86e9c2f99c8c0b457efc33015a96d4317800c1b6f7c335173283af53f842ce

Contents?: true

Size: 500 Bytes

Versions: 73

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      # Helps find the true end location of nodes which might contain heredocs.
      module FinalEndLocation
        def final_end_location(start_node)
          heredoc_endings =
            start_node.each_node(:str, :dstr, :xstr)
              .select(&:heredoc?)
              .map { |node| node.loc.heredoc_end }

          [start_node.loc.end, *heredoc_endings].max_by(&:line)
        end
      end
    end
  end
end

Version data entries

73 entries across 67 versions & 7 rubygems

Version Path
fablicop-1.10.2 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.22.0/lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.22.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.21.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.20.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.19.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.18.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.18.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.17.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.17.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.16.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.15.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.14.2 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.14.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.14.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.13.2 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.13.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.13.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.12.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.12.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.11.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb