Namespace

Included Modules

Class/Module Index [+]

Quicksearch

Origami::String

Module common to String objects.

Attributes

encoding[RW]

Public Class Methods

native_type() click to toggle source
# File lib/origami/string.rb, line 125
def self.native_type; Origami::String end

Public Instance Methods

eval_js() click to toggle source

Evaluates the current String as JavaScript.

# File lib/origami/javascript.rb, line 660
def eval_js
  self.pdf.eval_js(self.value)
end
to_pdfdoc() click to toggle source

Convert String object to a PDFDocEncoding encoded Ruby string.

# File lib/origami/string.rb, line 165
def to_pdfdoc
  infer_encoding
  self.encoding.to_pdfdoc(self.value)
end
to_utf16be() click to toggle source

Convert String object to an UTF16-BE encoded Ruby string.

# File lib/origami/string.rb, line 157
def to_utf16be
  infer_encoding
  self.encoding.to_utf16be(self.value)
end
to_utf8() click to toggle source

Convert String object to an UTF8 encoded Ruby string.

# File lib/origami/string.rb, line 139
def to_utf8
  infer_encoding

  if RUBY_VERSION < '1.9'
    require 'iconv'
    i = Iconv.new("UTF-8", "UTF-16")
      utf8str = i.iconv(self.encoding.to_utf16be(self.value))
    i.close
  else
    utf8str = self.encoding.to_utf16be(self.value).encode("utf-8", "utf-16")
  end

  utf8str
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.