Class: Hyperion::Riak::EqualsStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperion/riak/optimized_filter_order.rb

Instance Method Summary collapse

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

Returns:

  • (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

#filtersObject



52
53
54
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 52

def filters
  @remaining_filters ||= (@filters - [first_equals_filter])
end

#optimal_index_fieldObject



44
45
46
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 44

def optimal_index_field
  first_equals_filter.field
end

#optimal_index_valueObject



48
49
50
# File 'lib/hyperion/riak/optimized_filter_order.rb', line 48

def optimal_index_value
  first_equals_filter.value.to_s
end