Class: ThinkingSphinx::RealTime::Property

Inherits:
Object
  • Object
show all
Includes:
Core::Property
Defined in:
lib/thinking_sphinx/real_time/property.rb

Direct Known Subclasses

Attribute, Field

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::Property

#facet?, #multi?, #type

Constructor Details

#initialize(column, options = {}) ⇒ Property

Returns a new instance of Property.



8
9
10
11
12
# File 'lib/thinking_sphinx/real_time/property.rb', line 8

def initialize(column, options = {})
  @options = options
  @column  = column.respond_to?(:__name) ? column :
    ThinkingSphinx::ActiveRecord::Column.new(column)
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



6
7
8
# File 'lib/thinking_sphinx/real_time/property.rb', line 6

def column
  @column
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/thinking_sphinx/real_time/property.rb', line 6

def options
  @options
end

Instance Method Details

#nameObject



14
15
16
# File 'lib/thinking_sphinx/real_time/property.rb', line 14

def name
  (@options[:as] || @column.__name).to_s
end

#translate(object) ⇒ Object



18
19
20
# File 'lib/thinking_sphinx/real_time/property.rb', line 18

def translate(object)
  ThinkingSphinx::RealTime::Translator.call(object, @column)
end