class Doc2Text::XmlBasedDocument::XmlNodes::Node
Attributes
Public Class Methods
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
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
Source
# File lib/doc2text/generic_xml_nodes.rb, line 36 def delete return true unless @children @children.each { |child| child.delete } @children = [] end
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
Source
# File lib/doc2text/generic_xml_nodes.rb, line 59 def expand expanded = "#{open}#{@children.map(&:expand).join}#{close}" delete expanded.clone end
Source
# File lib/doc2text/generic_xml_nodes.rb, line 47 def generic? instance_of? Node end
Source
# File lib/doc2text/generic_xml_nodes.rb, line 55 def to_s "#{xml_name} : #{attrs}" end
Source
# File lib/doc2text/generic_xml_nodes.rb, line 51 def xml_name "#{@prefix}:#{@name}" end