Class: ThinkingSphinx::ActiveRecord::SQLBuilder
- Inherits:
-
Object
- Object
- ThinkingSphinx::ActiveRecord::SQLBuilder
- Defined in:
- lib/thinking_sphinx/active_record/sql_builder.rb
Defined Under Namespace
Classes: ClauseBuilder, Query, Statement
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source) ⇒ SQLBuilder
constructor
A new instance of SQLBuilder.
- #sql_query ⇒ Object
- #sql_query_pre ⇒ Object
- #sql_query_range ⇒ Object
Constructor Details
#initialize(source) ⇒ SQLBuilder
Returns a new instance of SQLBuilder.
8 9 10 |
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 8 def initialize(source) @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 6 def source @source end |
Instance Method Details
#sql_query ⇒ Object
12 13 14 |
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 12 def sql_query statement.to_relation.to_sql.gsub(/\n/, "\\\n") end |
#sql_query_pre ⇒ Object
21 22 23 |
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 21 def sql_query_pre query.to_query end |
#sql_query_range ⇒ Object
16 17 18 19 |
# File 'lib/thinking_sphinx/active_record/sql_builder.rb', line 16 def sql_query_range return nil if source.disable_range? statement.to_query_range_relation.to_sql end |