Class: Relix::Query::Clause
- Inherits:
-
Object
- Object
- Relix::Query::Clause
- Defined in:
- lib/relix/query.rb
Instance Method Summary collapse
- #all(options = {}) ⇒ Object
- #eq(value, options = {}) ⇒ Object
-
#initialize(redis, index) ⇒ Clause
constructor
A new instance of Clause.
- #lookup ⇒ Object
Constructor Details
#initialize(redis, index) ⇒ Clause
Returns a new instance of Clause.
23 24 25 26 27 |
# File 'lib/relix/query.rb', line 23 def initialize(redis, index) @redis = redis @index = index @options = {} end |
Instance Method Details
#all(options = {}) ⇒ Object
34 35 36 37 |
# File 'lib/relix/query.rb', line 34 def all(={}) @all = true @options = end |
#eq(value, options = {}) ⇒ Object
29 30 31 32 |
# File 'lib/relix/query.rb', line 29 def eq(value, ={}) @value = @index.normalize(value) @options = end |
#lookup ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/relix/query.rb', line 39 def lookup if @options[:limit] == 0 [] elsif @all @index.all(@redis, @options) else @index.eq(@redis, @value, @options) end end |