Class: ThinkingSphinx::RealTime::Translator

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/real_time/translator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, column) ⇒ Translator

Returns a new instance of Translator.



8
9
10
# File 'lib/thinking_sphinx/real_time/translator.rb', line 8

def initialize(object, column)
  @object, @column = object, column
end

Class Method Details

.call(object, column) ⇒ Object



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

def self.call(object, column)
  new(object, column).call
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
# File 'lib/thinking_sphinx/real_time/translator.rb', line 12

def call
  return name.call(object) if name.is_a?(Proc)
  return name   unless name.is_a?(Symbol)
  return result unless result.is_a?(String)

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