Sha256: 85f4cd0b81b600a1c1dda0747efd6827ed512387d8c0e70723cbc02629d59923
Contents?: true
Size: 1.89 KB
Versions: 6
Compression:
Stored size: 1.89 KB
Contents
# :stopdoc: module Nokogiri module XML class SyntaxError < ::Nokogiri::SyntaxError attr_accessor :cstruct def initialize(message) self.cstruct = LibXML::XmlSyntaxError.new(LibXML::XmlSyntaxError.allocate()) self.cstruct[:message] = FFI::MemoryPointer.from_string(message) end def domain cstruct[:domain] end def code cstruct[:code] end def message val = cstruct[:message] val.null? ? nil : val.read_string end undef_method :inspect alias_method :inspect, :message undef_method :to_s alias_method :to_s, :message def message=(string) unless cstruct[:message].null? LibXML.xmlFree(cstruct[:message]) end cstruct[:message] = string end def level cstruct[:level] end def file cstruct[:file].null? ? nil : cstruct[:file] end def line cstruct[:line] end def str1 cstruct[:str1].null? ? nil : cstruct[:str1] end def str2 cstruct[:str].null? ? nil : cstruct[:str] end def str3 cstruct[:str3].null? ? nil : cstruct[:str3] end def int1 cstruct[:int1] end def column cstruct[:int2] end alias_method :int2, :column class << self def error_array_pusher(array) Proc.new do |_ignored_, error| array << wrap(error) if array end end def wrap(error_ptr) error_struct = LibXML::XmlSyntaxError.allocate LibXML.xmlCopyError(error_ptr, error_struct) error_cstruct = LibXML::XmlSyntaxError.new(error_struct) error = self.allocate # will generate XML::XPath::SyntaxError or XML::SyntaxError error.cstruct = error_cstruct error end end end end end # :startdoc:
Version data entries
6 entries across 6 versions & 3 rubygems