Sha256: 75e7f7a8057904f5eb470d8ea8e0fd4268906b7d63349a81cc012d82b8302b89

Contents?: true

Size: 426 Bytes

Versions: 8

Compression:

Stored size: 426 Bytes

Contents

module RuboCop
  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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rubocop-rspec-1.32.0 lib/rubocop/rspec/final_end_location.rb
rubocop-rspec-1.31.0 lib/rubocop/rspec/final_end_location.rb
rubocop-rspec-1.30.1 lib/rubocop/rspec/final_end_location.rb
rubocop-rspec-1.30.0 lib/rubocop/rspec/final_end_location.rb
rubocop-rspec-1.29.1 lib/rubocop/rspec/final_end_location.rb
rubocop-rspec-1.29.0 lib/rubocop/rspec/final_end_location.rb
rubocop-rspec-1.28.0 lib/rubocop/rspec/final_end_location.rb
rubocop-rspec-1.27.0 lib/rubocop/rspec/final_end_location.rb