Class: ThinkingSphinx::Deltas::DefaultDelta
- Inherits:
-
Object
- Object
- ThinkingSphinx::Deltas::DefaultDelta
show all
- Defined in:
- lib/thinking_sphinx/deltas/default_delta.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(index, options) ⇒ DefaultDelta
Returns a new instance of DefaultDelta.
6
7
8
9
|
# File 'lib/thinking_sphinx/deltas/default_delta.rb', line 6
def initialize(index, options)
@index = index
@column = options.delete(:delta_column) || :delta
end
|
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
4
5
6
|
# File 'lib/thinking_sphinx/deltas/default_delta.rb', line 4
def column
@column
end
|
Instance Method Details
#clause(model, toggled) ⇒ Object
46
47
48
49
|
# File 'lib/thinking_sphinx/deltas/default_delta.rb', line 46
def clause(model, toggled)
"#{model.quoted_table_name}.#{model.connection.quote_column_name(@column.to_s)}" +
" = #{adapter.boolean(toggled)}"
end
|
#index(model, instance = nil) ⇒ Object
#reset_query(model) ⇒ Object
40
41
42
43
44
|
# File 'lib/thinking_sphinx/deltas/default_delta.rb', line 40
def reset_query(model)
"UPDATE #{model.quoted_table_name} SET " +
"#{model.connection.quote_column_name(@column.to_s)} = #{adapter.boolean(false)} " +
"WHERE #{model.connection.quote_column_name(@column.to_s)} = #{adapter.boolean(true)}"
end
|
#toggle(instance) ⇒ Object
32
33
34
|
# File 'lib/thinking_sphinx/deltas/default_delta.rb', line 32
def toggle(instance)
instance.delta = true
end
|
#toggled(instance) ⇒ Object
36
37
38
|
# File 'lib/thinking_sphinx/deltas/default_delta.rb', line 36
def toggled(instance)
instance.delta
end
|