Class: Quickfilter::Filter
- Inherits:
-
Object
- Object
- Quickfilter::Filter
- Defined in:
- lib/quickfilter/filter.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#field ⇒ Object
Returns the value of attribute field.
-
#operator ⇒ Object
Returns the value of attribute operator.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(table, field, operator, value, adapter) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(table, field, operator, value, adapter) ⇒ Filter
Returns a new instance of Filter.
8 9 10 11 12 13 |
# File 'lib/quickfilter/filter.rb', line 8 def initialize(table, field, operator, value, adapter) self.field = "#{table}.#{field}" self.operator = operator self.value = value self.adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/quickfilter/filter.rb', line 6 def adapter @adapter end |
#field ⇒ Object
Returns the value of attribute field.
6 7 8 |
# File 'lib/quickfilter/filter.rb', line 6 def field @field end |
#operator ⇒ Object
Returns the value of attribute operator.
6 7 8 |
# File 'lib/quickfilter/filter.rb', line 6 def operator @operator end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/quickfilter/filter.rb', line 6 def value @value end |
Instance Method Details
#build ⇒ Object
15 16 17 18 |
# File 'lib/quickfilter/filter.rb', line 15 def build return nil if self.value.blank? return Quickfilter::Handlers.get(self.operator, self.adapter).call(self.field, self.value) end |