debian-mirror-gitlab/rubocop/model_helpers.rb
2017-09-10 17:25:29 +05:30

11 lines
304 B
Ruby

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