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

- (PropertySQLPresenter) initialize(property, adapter, associations)

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

- (Object) adapter (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

- (Object) associations (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

- (Object) property (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

- (Object) to_group



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

def to_group
  return nil unless group?

  columns_with_table
end

- (Object) to_select



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

def to_select
  return nil if property.source_type.to_s[/query/]

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