Module: Gitlab::Styles::Rubocop::ModelHelpers
- Defined in:
- lib/gitlab/styles/rubocop/model_helpers.rb
Instance Method Summary collapse
-
#in_model?(node) ⇒ Boolean
Returns true if the given node originated from the models directory.
Instance Method Details
#in_model?(node) ⇒ Boolean
Returns true if the given node originated from the models directory.
6 7 8 9 10 11 |
# File 'lib/gitlab/styles/rubocop/model_helpers.rb', line 6 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 |