Class: PgSearch::Configuration::Column
- Inherits:
-
Object
- Object
- PgSearch::Configuration::Column
- Defined in:
- lib/pg_search/configuration/column.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
- #full_name ⇒ Object
-
#initialize(column_name, weight, model) ⇒ Column
constructor
A new instance of Column.
- #to_sql ⇒ Object
Constructor Details
#initialize(column_name, weight, model) ⇒ Column
Returns a new instance of Column.
10 11 12 13 14 15 16 |
# File 'lib/pg_search/configuration/column.rb', line 10 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 |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/pg_search/configuration/column.rb', line 8 def name @name end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
8 9 10 |
# File 'lib/pg_search/configuration/column.rb', line 8 def weight @weight end |
Instance Method Details
#full_name ⇒ Object
18 19 20 |
# File 'lib/pg_search/configuration/column.rb', line 18 def full_name "#{table_name}.#{column_name}" end |
#to_sql ⇒ Object
22 23 24 |
# File 'lib/pg_search/configuration/column.rb', line 22 def to_sql "coalesce(#{expression}::text, '')" end |