Class: QueryReport::FilterModule::Comparator
- Inherits:
-
Object
- Object
- QueryReport::FilterModule::Comparator
- Defined in:
- lib/query_report/filter.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #has_default? ⇒ Boolean
-
#initialize(filter, type, name, default = nil) ⇒ Comparator
constructor
A new instance of Comparator.
- #param_value ⇒ Object
- #search_key ⇒ Object
- #search_tag_name ⇒ Object
Constructor Details
#initialize(filter, type, name, default = nil) ⇒ Comparator
Returns a new instance of Comparator.
62 63 64 |
# File 'lib/query_report/filter.rb', line 62 def initialize(filter, type, name, default=nil) @filter, @type, @name, @default = filter, type, name, default.to_s end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
60 61 62 |
# File 'lib/query_report/filter.rb', line 60 def default @default end |
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
60 61 62 |
# File 'lib/query_report/filter.rb', line 60 def filter @filter end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
60 61 62 |
# File 'lib/query_report/filter.rb', line 60 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
60 61 62 |
# File 'lib/query_report/filter.rb', line 60 def type @type end |
Instance Method Details
#has_default? ⇒ Boolean
78 79 80 |
# File 'lib/query_report/filter.rb', line 78 def has_default? !@default.nil? end |
#param_value ⇒ Object
74 75 76 |
# File 'lib/query_report/filter.rb', line 74 def param_value @filter.params[@filter.params_key] ? @filter.params[@filter.params_key][search_key] : default end |
#search_key ⇒ Object
66 67 68 |
# File 'lib/query_report/filter.rb', line 66 def search_key "#{@filter.column.to_s}_#{@type}".to_sym end |
#search_tag_name ⇒ Object
70 71 72 |
# File 'lib/query_report/filter.rb', line 70 def search_tag_name "#{@filter.params_key}[#{search_key.to_s}]" end |