Class: Gitlab::Database::Aggregation::ActiveRecord::PartDefinition
- Inherits:
-
PartDefinition
- Object
- PartDefinition
- Gitlab::Database::Aggregation::ActiveRecord::PartDefinition
- Defined in:
- lib/gitlab/database/aggregation/active_record/part_definition.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#scope_proc ⇒ Object
readonly
Returns the value of attribute scope_proc.
Attributes inherited from PartDefinition
#description, #expression, #formatter, #name, #secondary_expression, #type
Instance Method Summary collapse
- #apply_scope(scope, context) ⇒ Object
-
#initialize(*args, scope_proc: nil, **kwargs) ⇒ PartDefinition
constructor
A new instance of PartDefinition.
Methods inherited from PartDefinition
#format_value, #identifier, #instance_key, #parameterized?, #validate_part
Constructor Details
#initialize(*args, scope_proc: nil, **kwargs) ⇒ PartDefinition
Returns a new instance of PartDefinition.
10 11 12 13 |
# File 'lib/gitlab/database/aggregation/active_record/part_definition.rb', line 10 def initialize(*args, scope_proc: nil, **kwargs) super @scope_proc = scope_proc end |
Instance Attribute Details
#scope_proc ⇒ Object (readonly)
Returns the value of attribute scope_proc.
8 9 10 |
# File 'lib/gitlab/database/aggregation/active_record/part_definition.rb', line 8 def scope_proc @scope_proc end |
Instance Method Details
#apply_scope(scope, context) ⇒ Object
15 16 17 |
# File 'lib/gitlab/database/aggregation/active_record/part_definition.rb', line 15 def apply_scope(scope, context) scope_proc ? scope_proc.call(scope, context) : scope end |