Welcome to mirror list, hosted at ThFree Co, Russian Federation.

model_helpers.rb « rubocop - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 309723dc34caa0cea339cabea33b3727631503c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
module RuboCop
  module ModelHelpers
    # Returns true if the given node originated from the models directory.
    def in_model?(node)
      path = node.location.expression.source_buffer.name
      models_path = File.join(Dir.pwd, 'app', 'models')

      path.start_with?(models_path)
    end
  end
end