Sha256: aa8a269a7a0909278315851ac737533136d90f449fca8f0a4652a445d2a586fa

Contents?: true

Size: 384 Bytes

Versions: 9

Compression:

Stored size: 384 Bytes

Contents

module Gitlab
  module Styles
    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gitlab-styles-2.4.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.3.2 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.3.1 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.3.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.2.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.1.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.0.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-1.0.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-0.1.0 lib/gitlab/styles/rubocop/model_helpers.rb