module EPUB::Parser::XMLDocument::Refinements::Oga
Public Instance Methods
Source
# File lib/epub/parser/xml_document/refinements/oga.rb, line 42 def attribute_with_prefix(name, prefix = nil) name = prefix ? "#{prefix}:#{name}" : name get(name) end
Source
# File lib/epub/parser/xml_document/refinements/oga.rb, line 47 def each_element(xpath = nil, &block) each_node do |node| throw :skip_children unless node.kind_of?(::Oga::XML::Element) block.call node end end
Source
# File lib/epub/parser/xml_document/refinements/oga.rb, line 35 def each_element_by_xpath(xpath, namespaces = nil, &block) xpath(xpath, namespaces: namespaces).each &block end
Source
# File lib/epub/parser/xml_document/refinements/oga.rb, line 25 def elements # Couldn't use find(&:element?) for Rubies under 2.6 children.select {|child| child.element?} end
Source
# File lib/epub/parser/xml_document/refinements/oga.rb, line 54 def namespace_uri namespace&.uri end
Source
# File lib/epub/parser/xml_document/refinements/oga.rb, line 59 def namespaces original_namespaces.each_with_object({}) {|(name, namespace), nss| nss[name] = namespace.uri } end
Also aliased as: original_namespaces
Source
# File lib/epub/parser/xml_document/refinements/oga.rb, line 31 def respond_to?(name, include_all = false) [:root, :elements].include?(name) || super end
Need for Rubies under 2.6
Calls superclass method
Source
# File lib/epub/parser/xml_document/refinements/oga.rb, line 20 def root # Couldn't use find(&:element?) for Rubies under 2.6 root_node.children.find {|child| child.element?} end