module Gitlab::Styles::Rubocop::ModelHelpers
Public Instance Methods
in_model?(node)
click to toggle source
Returns true if the given node originated from the models directory.
# File lib/gitlab/styles/rubocop/model_helpers.rb, line 8 def in_model?(node) path = node.location.expression.source_buffer.name pwd = Dir.pwd models_path = File.join(pwd, 'app', 'models') ee_models_path = File.join(pwd, 'ee', 'app', 'models') path.start_with?(models_path, ee_models_path) end