Sha256: 01cfccf5a744daf2a94373295df090e4b5753575a94a243d8164efca127cc1e5

Contents?: true

Size: 478 Bytes

Versions: 11

Compression:

Stored size: 478 Bytes

Contents

module ThinkingSphinx
  module ActiveRecord
    class SQLBuilder::ClauseBuilder
      def initialize(first_element)
        @clauses = [first_element]
      end

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

        self
      end

      def add_clause(clause)
        @clauses += Array(clause)
      end

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

      private

      attr_reader :clauses
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
thinking-sphinx-3.4.2 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.4.1 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.4.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.3.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.2.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.1.4 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.1.3 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.1.2 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.1.1 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.1.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.0.6 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb