Class: SqlQueryExecutor::Operators::Is
- Defined in:
- lib/sql_query_executor/operators/is.rb
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(query, collection) ⇒ Is
constructor
A new instance of Is.
- #selector ⇒ Object
Constructor Details
#initialize(query, collection) ⇒ Is
Returns a new instance of Is.
6 7 8 9 |
# File 'lib/sql_query_executor/operators/is.rb', line 6 def initialize(query, collection) super convert_operator end |
Instance Method Details
#execute! ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/sql_query_executor/operators/is.rb', line 11 def execute! @collection.select do |record| value = record.send(@field) value.send(@operator, @value) end end |
#selector ⇒ Object
19 20 21 |
# File 'lib/sql_query_executor/operators/is.rb', line 19 def selector @operator == '==' ? { @field => @value } : { @field => {'$ne' => @value} } end |