Sha256: 089dfc2c684131cb35d1a9dc35247a27dd38d6c13c5b734e7d10748fbefc612d

Contents?: true

Size: 509 Bytes

Versions: 17

Compression:

Stored size: 509 Bytes

Contents

# frozen_string_literal: true

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

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-5.5.1 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-5.5.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-5.4.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-5.3.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-5.2.1 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-5.2.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-5.1.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-5.0.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-4.4.1 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-4.4.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-4.3.2 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-4.3.1 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-4.3.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-4.2.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-4.1.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-4.0.0 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb