class ThinkingSphinx::RealTime::Translator

Attributes

column[R]
object[R]

Public Class Methods

call(object, column) click to toggle source
# File lib/thinking_sphinx/real_time/translator.rb, line 4
def self.call(object, column)
  new(object, column).call
end
new(object, column) click to toggle source
# File lib/thinking_sphinx/real_time/translator.rb, line 8
def initialize(object, column)
  @object, @column = object, column
end

Public Instance Methods

call() click to toggle source
# File lib/thinking_sphinx/real_time/translator.rb, line 12
def call
  return name   unless name.is_a?(Symbol)
  return result unless result.is_a?(String)

  result.gsub("\u0000", '').force_encoding "UTF-8"
end

Private Instance Methods

name() click to toggle source
# File lib/thinking_sphinx/real_time/translator.rb, line 23
def name
  @column.__name
end
owner() click to toggle source
# File lib/thinking_sphinx/real_time/translator.rb, line 27
def owner
  stack.inject(object) { |previous, node| previous.try node }
end
result() click to toggle source
# File lib/thinking_sphinx/real_time/translator.rb, line 31
def result
  @result ||= owner.try name
end
stack() click to toggle source
# File lib/thinking_sphinx/real_time/translator.rb, line 35
def stack
  @column.__stack
end