Class: Dbviewer::TableQueryParams
- Inherits:
-
Object
- Object
- Dbviewer::TableQueryParams
- Defined in:
- lib/dbviewer/table_query_params.rb
Overview
TableQueryParams encapsulates parameters for table querying operations
Instance Attribute Summary collapse
-
#column_filters ⇒ Object
readonly
Returns the value of attribute column_filters.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#max_records ⇒ Object
readonly
Returns the value of attribute max_records.
-
#order_by ⇒ Object
readonly
Returns the value of attribute order_by.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
Instance Method Summary collapse
-
#initialize(page: 1, order_by: nil, direction: "ASC", per_page: nil, column_filters: nil, max_records: 1000) ⇒ TableQueryParams
constructor
Initialize query parameters with defaults.
Constructor Details
#initialize(page: 1, order_by: nil, direction: "ASC", per_page: nil, column_filters: nil, max_records: 1000) ⇒ TableQueryParams
Initialize query parameters with defaults
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dbviewer/table_query_params.rb', line 13 def initialize( page: 1, order_by: nil, direction: "ASC", per_page: nil, column_filters: nil, max_records: 1000 ) @page = [ 1, page.to_i ].max @order_by = order_by @direction = normalize_direction(direction) @per_page = normalize_per_page(per_page || 25, max_records) @column_filters = column_filters || {} @max_records = max_records end |
Instance Attribute Details
#column_filters ⇒ Object (readonly)
Returns the value of attribute column_filters.
4 5 6 |
# File 'lib/dbviewer/table_query_params.rb', line 4 def column_filters @column_filters end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
4 5 6 |
# File 'lib/dbviewer/table_query_params.rb', line 4 def direction @direction end |
#max_records ⇒ Object (readonly)
Returns the value of attribute max_records.
4 5 6 |
# File 'lib/dbviewer/table_query_params.rb', line 4 def max_records @max_records end |
#order_by ⇒ Object (readonly)
Returns the value of attribute order_by.
4 5 6 |
# File 'lib/dbviewer/table_query_params.rb', line 4 def order_by @order_by end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
4 5 6 |
# File 'lib/dbviewer/table_query_params.rb', line 4 def page @page end |
#per_page ⇒ Object (readonly)
Returns the value of attribute per_page.
4 5 6 |
# File 'lib/dbviewer/table_query_params.rb', line 4 def per_page @per_page end |