Class: ActiveRecordSeek::Operators::BaseOperator

Inherits:
Object
  • Object
show all
Includes:
Concerns::InstanceVariableConcern
Defined in:
lib/active_record_seek/operators/base_operator.rb

Instance Method Summary collapse

Methods included from Concerns::InstanceVariableConcern

#after_initialize, #initialize, #instance_variable_reset, #instance_variable_yield, #set

Instance Method Details

#apply(query) ⇒ Object



26
27
28
29
# File 'lib/active_record_seek/operators/base_operator.rb', line 26

def apply(query)
  set(query: query)
  query.where(arel_operation)
end

#arel_columnObject



14
15
16
# File 'lib/active_record_seek/operators/base_operator.rb', line 14

def arel_column
  arel_table[component.column]
end

#arel_operationObject



22
23
24
# File 'lib/active_record_seek/operators/base_operator.rb', line 22

def arel_operation
  arel_column.send(component.operator, arel_value)
end

#arel_tableObject



10
11
12
# File 'lib/active_record_seek/operators/base_operator.rb', line 10

def arel_table
  query.arel_table
end

#arel_valueObject



18
19
20
# File 'lib/active_record_seek/operators/base_operator.rb', line 18

def arel_value
  component.value
end