Class: ThinkingSphinx::ActiveRecord::Attribute::Values

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

Instance Method Summary (collapse)

Constructor Details

- (Values) initialize(attribute)



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

def initialize(attribute)
  @attribute = attribute
end

Instance Method Details

- (Object) value_for(instance)



6
7
8
9
10
11
# File 'lib/thinking_sphinx/active_record/attribute/values.rb', line 6

def value_for(instance)
  object = column.__stack.inject(instance) { |object, name|
    object.nil? ? nil : object.send(name)
  }
  object.nil? ? nil : object.send(column.__name)
end