class Doc2Text::XmlBasedDocument::XmlNodes::Node
Attributes
attrs[R]
children[R]
name[R]
parent[R]
prefix[R]
text[RW]
Public Class Methods
inherited(subclass)
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 8 def self.inherited(subclass) def subclass.titleize(tag) tag.split('-').map(&:capitalize).join end end
new(parent = nil, attrs = [], prefix = nil, name = nil, markdown_odt_parser = nil)
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 14 def initialize(parent = nil, attrs = [], prefix = nil, name = nil, markdown_odt_parser = nil) @parent, @attrs, @prefix, @name, @xml_parser = parent, attrs, prefix, name, markdown_odt_parser @children = [] @has_text = false end
Public Instance Methods
close()
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 32 def close '' end
delete()
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 36 def delete return true unless @children @children.each { |child| child.delete } @children = [] end
eql?(object)
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 42 def eql?(object) return false unless object.is_a? Node object.xml_name == xml_name end
expand()
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 59 def expand expanded = "#{open}#{@children.map(&:expand).join}#{close}" delete expanded.clone end
generic?()
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 47 def generic? instance_of? Node end
has_text?()
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 24 def has_text? @has_text end
open()
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 28 def open '' end
root?()
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 20 def root? !@parent end
to_s()
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 55 def to_s "#{xml_name} : #{attrs}" end
xml_name()
click to toggle source
# File lib/doc2text/generic_xml_nodes.rb, line 51 def xml_name "#{@prefix}:#{@name}" end