Sha256: 8c8ce2c6b661d3db6c1ebdf8c0c3c9347c1b6c42e68f3878a29f633abdb30184

Contents?: true

Size: 412 Bytes

Versions: 1

Compression:

Stored size: 412 Bytes

Contents

class ThinkingSphinx::RealTime::Property
  attr_reader :options

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

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

  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.0.rc lib/thinking_sphinx/real_time/property.rb