Class: GestartAdmino::Query::Configuration
- Inherits:
-
Object
- Object
- GestartAdmino::Query::Configuration
- Defined in:
- lib/gestart_admino/query/configuration.rb
Defined Under Namespace
Classes: FilterGroup, SearchField, Sorting
Instance Attribute Summary collapse
-
#ending_scope_callable ⇒ Object
Returns the value of attribute ending_scope_callable.
-
#filter_groups ⇒ Object
readonly
Returns the value of attribute filter_groups.
-
#permitted_params ⇒ Object
readonly
Returns the value of attribute permitted_params.
-
#search_fields ⇒ Object
readonly
Returns the value of attribute search_fields.
-
#sorting ⇒ Object
readonly
Returns the value of attribute sorting.
-
#starting_scope_callable ⇒ Object
Returns the value of attribute starting_scope_callable.
Instance Method Summary collapse
- #add_filter_group(name, scopes, options = {}) ⇒ Object
- #add_permitted_params(*names) ⇒ Object
- #add_search_field(name, options = {}) ⇒ Object
- #add_sorting_scopes(scopes, options = {}) ⇒ Object
- #declared_query_keys ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
78 79 80 81 82 |
# File 'lib/gestart_admino/query/configuration.rb', line 78 def initialize @search_fields = [] @filter_groups = [] @permitted_params = [] end |
Instance Attribute Details
#ending_scope_callable ⇒ Object
Returns the value of attribute ending_scope_callable.
76 77 78 |
# File 'lib/gestart_admino/query/configuration.rb', line 76 def ending_scope_callable @ending_scope_callable end |
#filter_groups ⇒ Object (readonly)
Returns the value of attribute filter_groups.
72 73 74 |
# File 'lib/gestart_admino/query/configuration.rb', line 72 def filter_groups @filter_groups end |
#permitted_params ⇒ Object (readonly)
Returns the value of attribute permitted_params.
74 75 76 |
# File 'lib/gestart_admino/query/configuration.rb', line 74 def permitted_params @permitted_params end |
#search_fields ⇒ Object (readonly)
Returns the value of attribute search_fields.
71 72 73 |
# File 'lib/gestart_admino/query/configuration.rb', line 71 def search_fields @search_fields end |
#sorting ⇒ Object (readonly)
Returns the value of attribute sorting.
73 74 75 |
# File 'lib/gestart_admino/query/configuration.rb', line 73 def sorting @sorting end |
#starting_scope_callable ⇒ Object
Returns the value of attribute starting_scope_callable.
75 76 77 |
# File 'lib/gestart_admino/query/configuration.rb', line 75 def starting_scope_callable @starting_scope_callable end |
Instance Method Details
#add_filter_group(name, scopes, options = {}) ⇒ Object
98 99 100 101 102 |
# File 'lib/gestart_admino/query/configuration.rb', line 98 def add_filter_group(name, scopes, = {}) FilterGroup.new(name, scopes, ).tap do |filter_group| self.filter_groups << filter_group end end |
#add_permitted_params(*names) ⇒ Object
84 85 86 |
# File 'lib/gestart_admino/query/configuration.rb', line 84 def add_permitted_params(*names) @permitted_params |= names.flatten.map(&:to_sym) end |
#add_search_field(name, options = {}) ⇒ Object
92 93 94 95 96 |
# File 'lib/gestart_admino/query/configuration.rb', line 92 def add_search_field(name, = {}) SearchField.new(name, ).tap do |search_field| self.search_fields << search_field end end |
#add_sorting_scopes(scopes, options = {}) ⇒ Object
104 105 106 |
# File 'lib/gestart_admino/query/configuration.rb', line 104 def add_sorting_scopes(scopes, = {}) @sorting = Sorting.new(scopes, ) end |
#declared_query_keys ⇒ Object
88 89 90 |
# File 'lib/gestart_admino/query/configuration.rb', line 88 def declared_query_keys search_fields.map(&:name) + filter_groups.map(&:name) end |