Class: QueryReport::FilterModule::Filter
- Inherits:
-
Object
- Object
- QueryReport::FilterModule::Filter
- Defined in:
- lib/query_report/filter.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#comparators ⇒ Object
readonly
Returns the value of attribute comparators.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #custom? ⇒ Boolean
- #has_default? ⇒ Boolean
-
#initialize(params, column, options, &block) ⇒ Filter
constructor
Initializes filter with the proper parameters.
- #params_key ⇒ Object
- #search_keys ⇒ Object
Constructor Details
#initialize(params, column, options, &block) ⇒ Filter
Initializes filter with the proper parameters
62 63 64 65 66 |
# File 'lib/query_report/filter.rb', line 62 def initialize(params, column, , &block) @params, @column, @options, @comparators, @block = params, column, , [], block @type = .kind_of?(String) ? : [:type] generate_comparators end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
55 56 57 |
# File 'lib/query_report/filter.rb', line 55 def block @block end |
#column ⇒ Object (readonly)
Returns the value of attribute column.
55 56 57 |
# File 'lib/query_report/filter.rb', line 55 def column @column end |
#comparators ⇒ Object (readonly)
Returns the value of attribute comparators.
55 56 57 |
# File 'lib/query_report/filter.rb', line 55 def comparators @comparators end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
55 56 57 |
# File 'lib/query_report/filter.rb', line 55 def @options end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
55 56 57 |
# File 'lib/query_report/filter.rb', line 55 def params @params end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
55 56 57 |
# File 'lib/query_report/filter.rb', line 55 def type @type end |
Class Method Details
.supported_types ⇒ Object
68 69 70 |
# File 'lib/query_report/filter.rb', line 68 def self.supported_types [:date, :datetime, :text, :boolean] end |
Instance Method Details
#custom? ⇒ Boolean
78 79 80 |
# File 'lib/query_report/filter.rb', line 78 def custom? (@block || @options[:manual]) ? true : false end |
#has_default? ⇒ Boolean
86 87 88 |
# File 'lib/query_report/filter.rb', line 86 def has_default? @comparators.any?(&:has_default?) end |
#params_key ⇒ Object
90 91 92 |
# File 'lib/query_report/filter.rb', line 90 def params_key custom? ? :custom_search : :q end |
#search_keys ⇒ Object
82 83 84 |
# File 'lib/query_report/filter.rb', line 82 def search_keys @comparators.collect(&:search_key) end |