Class: ThinkingSphinx::ActiveRecord::SQLBuilder::ClauseBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(first_element) ⇒ ClauseBuilder

Returns a new instance of ClauseBuilder



4
5
6
# File 'lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb', line 4

def initialize(first_element)
  @first_element = first_element
end

Instance Method Details

#add_clause(clause) ⇒ Object



13
14
15
# File 'lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb', line 13

def add_clause(clause)
  self.clauses += Array(clause)
end

#compose(*additions) ⇒ Object



8
9
10
11
# File 'lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb', line 8

def compose(*additions)
  additions.each &method(:add_clause)
  self
end

#separated(by = ', ') ⇒ Object



17
18
19
# File 'lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb', line 17

def separated(by = ', ')
  clauses.flatten.compact.join(by)
end