class Itex2MML::Parser
Public Class Methods
Source
# File lib/itextomml.rb, line 53 def self.semaphore @semaphore ||= Mutex.new end
Public Instance Methods
Source
# File lib/itextomml.rb, line 69 def block_filter(string) parse("\$\$#{string}\$\$", :itex2MML_filter) end
Source
# File lib/itextomml.rb, line 61 def filter(string) parse(string, :itex2MML_filter) end
Source
# File lib/itextomml.rb, line 57 def html_filter(string) parse(string, :itex2MML_html_filter) end
Source
# File lib/itextomml.rb, line 65 def inline_filter(string) parse("\$#{string}\$", :itex2MML_filter) end
Private Instance Methods
Source
# File lib/itextomml.rb, line 84 def as_bytes(string) string.force_encoding("ASCII-8BIT") end
Source
# File lib/itextomml.rb, line 87 def as_utf8(string) string.force_encoding("UTF-8") end
Source
# File lib/itextomml.rb, line 75 def parse(string, message) str = as_bytes(string.to_str) self.class.semaphore.synchronize do raise Itex2MML::Error unless Itex2MML.send(message, str, str.length) == 0 as_utf8(Itex2MML.itex2MML_output) end end