Module: Ray::TextHelper

Included in:
Font, Text
Defined in:
lib/ray/text_helper.rb

Instance Method Summary collapse

Instance Method Details

#convert(string, enc = "UTF-8") ⇒ String

Returns string converted to the asked encoding.

Parameters:

  • string (String)

    A string encoded using Ray’s internal encoding

  • enc (String) (defaults to: "UTF-8")

    Output encoding

Returns:

  • (String)

    string converted to the asked encoding



18
19
20
# File 'lib/ray/text_helper.rb', line 18

def convert(string, enc = "UTF-8")
  string.encode enc
end

#internal_string(string, enc = "UTF-8") ⇒ String

Returns String in Ray’s internal encoding.

Parameters:

  • string (String)

    Any string

  • enc (String) (defaults to: "UTF-8")

    Name of the encoding of String. Gueseed in 1.9.

Returns:

  • (String)

    String in Ray’s internal encoding



10
11
12
# File 'lib/ray/text_helper.rb', line 10

def internal_string(string, enc = "UTF-8")
  string.encode(InternalEncoding)
end