Class: WillFilter::FilterCondition
- Inherits:
-
Object
- Object
- WillFilter::FilterCondition
- Defined in:
- lib/will_filter/filter_condition.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
Returns the value of attribute container.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#key ⇒ Object
Returns the value of attribute key.
-
#operator ⇒ Object
Returns the value of attribute operator.
Instance Method Summary collapse
- #full_key ⇒ Object
-
#initialize(filter, key, operator, container_class, values) ⇒ FilterCondition
constructor
A new instance of FilterCondition.
- #serialize_to_params(params, index) ⇒ Object
- #to_s ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(filter, key, operator, container_class, values) ⇒ FilterCondition
Returns a new instance of FilterCondition.
37 38 39 40 41 42 |
# File 'lib/will_filter/filter_condition.rb', line 37 def initialize(filter, key, operator, container_class, values) @filter = filter @key = key @operator = operator @container = WillFilter::Config.containers[container_class].constantize.new(filter, self, operator, values) end |
Instance Attribute Details
#container ⇒ Object
Returns the value of attribute container.
35 36 37 |
# File 'lib/will_filter/filter_condition.rb', line 35 def container @container end |
#filter ⇒ Object
Returns the value of attribute filter.
35 36 37 |
# File 'lib/will_filter/filter_condition.rb', line 35 def filter @filter end |
#key ⇒ Object
Returns the value of attribute key.
35 36 37 |
# File 'lib/will_filter/filter_condition.rb', line 35 def key @key end |
#operator ⇒ Object
Returns the value of attribute operator.
35 36 37 |
# File 'lib/will_filter/filter_condition.rb', line 35 def operator @operator end |
Instance Method Details
#full_key ⇒ Object
55 56 57 |
# File 'lib/will_filter/filter_condition.rb', line 55 def full_key filter.sql_attribute_for_key(key) end |
#serialize_to_params(params, index) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/will_filter/filter_condition.rb', line 48 def serialize_to_params(params, index) params["wf_c#{index}".to_sym] = key params["wf_o#{index}".to_sym] = operator container.serialize_to_params(params, index) params end |
#to_s ⇒ Object
59 60 61 |
# File 'lib/will_filter/filter_condition.rb', line 59 def to_s key end |
#validate ⇒ Object
44 45 46 |
# File 'lib/will_filter/filter_condition.rb', line 44 def validate container.validate end |