Class: DbdocEngine::TableFilterService
- Inherits:
-
Object
- Object
- DbdocEngine::TableFilterService
- Defined in:
- app/services/dbdoc_engine/table_filter_service.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
-
#filter ⇒ Object
Apply all filters and return the filtered tables relation.
-
#initialize(tables, params) ⇒ TableFilterService
constructor
Initialize with a base tables relation and filtering params.
Constructor Details
#initialize(tables, params) ⇒ TableFilterService
Initialize with a base tables relation and filtering params
7 8 9 10 |
# File 'app/services/dbdoc_engine/table_filter_service.rb', line 7 def initialize(tables, params) @tables = tables @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'app/services/dbdoc_engine/table_filter_service.rb', line 4 def params @params end |
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
4 5 6 |
# File 'app/services/dbdoc_engine/table_filter_service.rb', line 4 def tables @tables end |
Instance Method Details
#filter ⇒ Object
Apply all filters and return the filtered tables relation
13 14 15 16 17 |
# File 'app/services/dbdoc_engine/table_filter_service.rb', line 13 def filter @tables = apply_group_filter # Filter by group if param present @tables = apply_search # Filter by search if param present tables # Return the final filtered relation end |