Class: ThinkingSphinx::UTF8

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ UTF8

Returns a new instance of UTF8.



10
11
12
# File 'lib/thinking_sphinx/utf8.rb', line 10

def initialize(string)
  @string = string
end

Instance Attribute Details

#stringObject (readonly)

Returns the value of attribute string.



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

def string
  @string
end

Class Method Details

.encode(string) ⇒ Object



6
7
8
# File 'lib/thinking_sphinx/utf8.rb', line 6

def self.encode(string)
  new(string).encode
end

Instance Method Details

#encodeObject



14
15
16
17
# File 'lib/thinking_sphinx/utf8.rb', line 14

def encode
  string.encode!('ISO-8859-1')
  string.force_encoding('UTF-8')
end