Module: Gitlab::SearchContext::ControllerConcern
- Extended by:
- ActiveSupport::Concern
- Included in:
- ApplicationController
- Defined in:
- lib/gitlab/search_context.rb
Instance Method Summary collapse
-
#search_context ⇒ Object
rubocop:disable Gitlab/ModuleWithInstanceVariables.
Instance Method Details
#search_context ⇒ Object
rubocop:disable Gitlab/ModuleWithInstanceVariables
Introspect the current controller’s assignments and and builds the proper SearchContext object for it.
151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/gitlab/search_context.rb', line 151 def search_context builder = Builder.new(view_context) builder.with_snippet(@snippet) if @snippet.present? @snippets.each(&builder.method(:with_snippet)) if @snippets.present? builder.with_project(@project) if @project.present? && @project.persisted? builder.with_group(@group) if @group.present? && @group.persisted? builder.with_ref(@ref) if @ref.present? builder.build! end |