Sha256: 839ede794b34b5a7e806cff3b794a95578ea2acedc567b4ac9c30baf0637bca9

Contents?: true

Size: 406 Bytes

Versions: 17

Compression:

Stored size: 406 Bytes

Contents

# frozen_string_literal: true

class ThinkingSphinx::ActiveRecord::Attribute::Values
  def initialize(attribute)
    @attribute = attribute
  end

  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

  private

  def column
    @attribute.columns.first
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-5.5.1 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-5.5.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-5.4.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-5.3.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-5.2.1 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-5.2.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-5.1.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-5.0.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-4.4.1 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-4.4.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-4.3.2 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-4.3.1 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-4.3.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-4.2.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-4.1.0 lib/thinking_sphinx/active_record/attribute/values.rb
thinking-sphinx-4.0.0 lib/thinking_sphinx/active_record/attribute/values.rb