Module: Banzai::CrossProjectReference

Included in:
Filter::AbstractReferenceFilter
Defined in:
lib/banzai/cross_project_reference.rb

Overview

Common methods for ReferenceFilters that support an optional cross-project reference.

Instance Method Summary collapse

Instance Method Details

#project_from_ref(ref) ⇒ Object

Given a cross-project reference string, get the Project record

Defaults to value of `context` if:

  • No reference is given OR

  • Reference given doesn't exist

ref - String reference.

Returns a Project, or nil if the reference can't be found


14
15
16
17
18
# File 'lib/banzai/cross_project_reference.rb', line 14

def project_from_ref(ref)
  return context[:project] unless ref

  Project.find_with_namespace(ref)
end