Class: Environments::EnvironmentsFinder
- Inherits:
-
Object
- Object
- Environments::EnvironmentsFinder
- Defined in:
- app/finders/environments/environments_finder.rb
Constant Summary collapse
- InvalidStatesError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, current_user, params = {}) ⇒ EnvironmentsFinder
constructor
A new instance of EnvironmentsFinder.
Constructor Details
#initialize(project, current_user, params = {}) ⇒ EnvironmentsFinder
Returns a new instance of EnvironmentsFinder.
9 10 11 12 13 |
# File 'app/finders/environments/environments_finder.rb', line 9 def initialize(project, current_user, params = {}) @project = project @current_user = current_user @params = params end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
5 6 7 |
# File 'app/finders/environments/environments_finder.rb', line 5 def current_user @current_user end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'app/finders/environments/environments_finder.rb', line 5 def params @params end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
5 6 7 |
# File 'app/finders/environments/environments_finder.rb', line 5 def project @project end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/finders/environments/environments_finder.rb', line 15 def execute environments = project.environments environments = by_type(environments) environments = by_name(environments) environments = by_search(environments) environments = by_ids(environments) # Raises InvalidStatesError if params[:states] contains invalid states. by_states(environments) end |