Sha256: fb462c9ef84e7fc216f8a7eaa264921c132de2ce2c762eca43017616f25e054e

Contents?: true

Size: 554 Bytes

Versions: 2

Compression:

Stored size: 554 Bytes

Contents

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

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

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

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

      protected
      attr_accessor :clauses
      def clauses
        @clauses ||= [@first_element]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.5 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb
thinking-sphinx-3.0.4 lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb