Class: ThinkingSphinx::ActiveRecord::PropertySQLPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/active_record/property_sql_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(property, adapter, associations) ⇒ PropertySQLPresenter

Returns a new instance of PropertySQLPresenter



4
5
6
# File 'lib/thinking_sphinx/active_record/property_sql_presenter.rb', line 4

def initialize(property, adapter, associations)
  @property, @adapter, @associations = property, adapter, associations
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter



2
3
4
# File 'lib/thinking_sphinx/active_record/property_sql_presenter.rb', line 2

def adapter
  @adapter
end

#associationsObject (readonly)

Returns the value of attribute associations



2
3
4
# File 'lib/thinking_sphinx/active_record/property_sql_presenter.rb', line 2

def associations
  @associations
end

#propertyObject (readonly)

Returns the value of attribute property



2
3
4
# File 'lib/thinking_sphinx/active_record/property_sql_presenter.rb', line 2

def property
  @property
end

Instance Method Details

#to_groupObject



8
9
10
11
12
# File 'lib/thinking_sphinx/active_record/property_sql_presenter.rb', line 8

def to_group
  return nil if sourced_by_query? || !group?

  columns_with_table
end

#to_selectObject



14
15
16
17
18
# File 'lib/thinking_sphinx/active_record/property_sql_presenter.rb', line 14

def to_select
  return nil if sourced_by_query?

  "#{casted_column_with_table} AS #{adapter.quote property.name}"
end