Class: FeatureFlagsFinder
- Inherits:
-
Object
- Object
- FeatureFlagsFinder
- Defined in:
- app/finders/feature_flags_finder.rb
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(preload: true) ⇒ Object
-
#initialize(project, current_user, params = {}) ⇒ FeatureFlagsFinder
constructor
A new instance of FeatureFlagsFinder.
Constructor Details
#initialize(project, current_user, params = {}) ⇒ FeatureFlagsFinder
Returns a new instance of FeatureFlagsFinder.
6 7 8 9 10 |
# File 'app/finders/feature_flags_finder.rb', line 6 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.
4 5 6 |
# File 'app/finders/feature_flags_finder.rb', line 4 def current_user @current_user end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'app/finders/feature_flags_finder.rb', line 4 def params @params end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
4 5 6 |
# File 'app/finders/feature_flags_finder.rb', line 4 def project @project end |
Instance Method Details
#execute(preload: true) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/finders/feature_flags_finder.rb', line 12 def execute(preload: true) unless Ability.allowed?(current_user, :read_feature_flag, project) return Operations::FeatureFlag.none end items = feature_flags items = by_scope(items) items = items.preload_relations if preload items.ordered end |