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
rubocop-rspec-2.11.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.10.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.9.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.8.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.7.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.6.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.5.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.4.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.3.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.2.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.1.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.0.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.0.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb