Class: Nokogiri::EncodingHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/nokogiri/ffi/encoding_handler.rb,
ext/nokogiri/xml_encoding_handler.c

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cstructObject

:stopdoc:



4
5
6
# File 'lib/nokogiri/ffi/encoding_handler.rb', line 4

def cstruct
  @cstruct
end

Class Method Details

.Nokogiri::EncodingHandler.[](name) ⇒ Object

Get the encoding handler for name



8
9
10
11
# File 'ext/nokogiri/xml_encoding_handler.c', line 8

def [](key)
  handler = LibXML.xmlFindCharEncodingHandler(key)
  handler.null? ? nil : wrap(handler)
end

.Nokogiri::EncodingHandler.alias(from, to) ⇒ Object

Alias encoding handler with name from to name to



36
37
38
39
# File 'ext/nokogiri/xml_encoding_handler.c', line 36

def alias(from, to)
  LibXML.xmlAddEncodingAlias(from, to)
  to
end

.Nokogiri::EncodingHandler.clear_aliases!Object

Remove all encoding aliases.



48
49
50
51
# File 'ext/nokogiri/xml_encoding_handler.c', line 48

def clear_aliases!
  LibXML.xmlCleanupEncodingAliases
  self
end

.Nokogiri::EncodingHandler.delete(name) ⇒ Object

Delete the encoding alias named name



24
25
26
# File 'ext/nokogiri/xml_encoding_handler.c', line 24

def delete(name)
  (LibXML.xmlDelEncodingAlias(name) != 0) ? nil : true
end

Instance Method Details

#nameObject

Get the name of this EncodingHandler



60
61
62
# File 'ext/nokogiri/xml_encoding_handler.c', line 60

def name
  cstruct[:name]
end