Sha256: f66166bc43f6f02819e5f72767c07d99dea63dd100f9fdb9c6fabd200f6dedc5

Contents?: true

Size: 701 Bytes

Versions: 17

Compression:

Stored size: 701 Bytes

Contents

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

17 entries across 17 versions & 1 rubygems

Version Path
pg_search-2.1.3 lib/pg_search/configuration/column.rb
pg_search-2.1.2 lib/pg_search/configuration/column.rb
pg_search-2.1.1 lib/pg_search/configuration/column.rb
pg_search-2.1.0 lib/pg_search/configuration/column.rb
pg_search-2.0.1 lib/pg_search/configuration/column.rb
pg_search-2.0.0 lib/pg_search/configuration/column.rb
pg_search-1.0.6 lib/pg_search/configuration/column.rb
pg_search-1.0.5 lib/pg_search/configuration/column.rb
pg_search-1.0.4 lib/pg_search/configuration/column.rb
pg_search-1.0.3 lib/pg_search/configuration/column.rb
pg_search-1.0.2 lib/pg_search/configuration/column.rb
pg_search-1.0.1 lib/pg_search/configuration/column.rb
pg_search-1.0.0 lib/pg_search/configuration/column.rb
pg_search-0.7.9 lib/pg_search/configuration/column.rb
pg_search-0.7.8 lib/pg_search/configuration/column.rb
pg_search-0.7.7 lib/pg_search/configuration/column.rb
pg_search-0.7.6 lib/pg_search/configuration/column.rb