Refactor "Include templates"

The following discussions from !23495 (merged) should be addressed:

  • @grzesiek started a discussion: (+3 comments)

    It is a little confusing that both params and context are hashes. Is there a way to have only one argument passed to this constructor somehow?

  • @grzesiek started a discussion: (+1 comment)

    Is that a sign that we might need a separate class to handle location? Perhaps we can have enumerable Location? This looks like a code smell.

  • @grzesiek started a discussion: (+1 comment)

    Overriding described_class this way might be an indication that our design needs some improvements. Is there a way to get rid of that override by tweaking params we are passing to the constructor?

  • @grzesiek started a discussion:

    Why can't we just pass location?

  • @grzesiek started a discussion: (+2 comments)

    Wouldn't it be easier to create FILE_CLASSES objects here with context? I find it quite confusing that we first normalize locations and then use select_first_matching. What is the benefit vs previous approach?

Edited by Grzegorz Bizon