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

- (Property) initialize(column, options = {})

Returns a new instance of Property



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

def initialize(column, options = {})
  @column, @options = column, options
end

Instance Attribute Details

- (Object) options (readonly)

Returns the value of attribute options



4
5
6
# File 'lib/thinking_sphinx/real_time/property.rb', line 4

def options
  @options
end

Instance Method Details

- (Object) name



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

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

- (Object) translate(object)



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

def translate(object)
  return @column.__name unless @column.__name.is_a?(Symbol)

  base = @column.__stack.inject(object) { |base, node| base.try(node) }
  base.try(@column.__name)
end