Sha256: 66dbe15194242c39c78d0a0442160c51418459c5e388090705bb487e07d3d097

Contents?: true

Size: 732 Bytes

Versions: 12

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true

require 'digest'

module PgSearch
  class Configuration
    class Column
      attr_reader :weight, :name

      def initialize(column_name, weight, model)
        @name = column_name.to_s
        @column_name = column_name.to_s
        @weight = weight
        @model = model
        @connection = model.connection
      end

      def full_name
        "#{table_name}.#{column_name}"
      end

      def to_sql
        "coalesce(#{expression}::text, '')"
      end

      private

      def table_name
        @model.quoted_table_name
      end

      def column_name
        @connection.quote_column_name(@column_name)
      end

      def expression
        full_name
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pg_search-2.3.6 lib/pg_search/configuration/column.rb
pg_search-2.3.5 lib/pg_search/configuration/column.rb
pg_search-2.3.4 lib/pg_search/configuration/column.rb
pg_search-2.3.3 lib/pg_search/configuration/column.rb
pg_search-2.3.2 lib/pg_search/configuration/column.rb
pg_search-2.3.1 lib/pg_search/configuration/column.rb
pg_search-2.3.0 lib/pg_search/configuration/column.rb
pg_search-2.2.0 lib/pg_search/configuration/column.rb
pg_search-2.1.7 lib/pg_search/configuration/column.rb
pg_search-2.1.6 lib/pg_search/configuration/column.rb
pg_search-2.1.5 lib/pg_search/configuration/column.rb
pg_search-2.1.4 lib/pg_search/configuration/column.rb