Class: Hyperion::Riak::EqualsStrategy
- Inherits:
-
Object
- Object
- Hyperion::Riak::EqualsStrategy
- Defined in:
- lib/hyperion/riak/optimized_filter_order.rb
Instance Method Summary collapse
- #can_optimize? ⇒ Boolean
- #filters ⇒ Object
-
#initialize(filters, bucket_name) ⇒ EqualsStrategy
constructor
A new instance of EqualsStrategy.
- #optimal_index_field ⇒ Object
- #optimal_index_value ⇒ Object
Constructor Details
#initialize(filters, bucket_name) ⇒ EqualsStrategy
Returns a new instance of EqualsStrategy.
36 37 38 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 36 def initialize(filters, bucket_name) @filters = filters end |
Instance Method Details
#can_optimize? ⇒ Boolean
40 41 42 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 40 def can_optimize? !first_equals_filter.nil? && !first_equals_filter.value.nil? end |
#filters ⇒ Object
52 53 54 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 52 def filters @remaining_filters ||= (@filters - [first_equals_filter]) end |
#optimal_index_field ⇒ Object
44 45 46 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 44 def optimal_index_field first_equals_filter.field end |
#optimal_index_value ⇒ Object
48 49 50 |
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 48 def optimal_index_value first_equals_filter.value.to_s end |