Class: Ci::VariablesFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/ci/variables_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, params) ⇒ VariablesFinder

Returns a new instance of VariablesFinder.

Raises:

  • (ArgumentError)

7
8
9
10
11
# File 'app/finders/ci/variables_finder.rb', line 7

def initialize(project, params)
  @project, @params = project, params

  raise ArgumentError, 'Please provide params[:key]' if params[:key].blank?
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params


5
6
7
# File 'app/finders/ci/variables_finder.rb', line 5

def params
  @params
end

#projectObject (readonly)

Returns the value of attribute project


5
6
7
# File 'app/finders/ci/variables_finder.rb', line 5

def project
  @project
end

Instance Method Details

#executeObject


13
14
15
16
17
18
# File 'app/finders/ci/variables_finder.rb', line 13

def execute
  variables = project.variables
  variables = by_key(variables)
  variables = by_environment_scope(variables)
  variables
end