Sha256: 1e7559b2da2d1f42bbc405be886276eb669dda2473a50115bea29412245678ae
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true module Kitchen # An element for a composite chapter # class CompositeChapterElement < ElementBase # Creates a new +CompositeChapterElement+ # # @param node [Nokogiri::XML::Node] the node this element wraps # @param document [Document] this element's document # def initialize(node:, document: nil) super(node: node, document: document, enumerator_class: ElementEnumerator, short_type: :composite_chapter) end # Returns the title element (the one in the immediate children, not the one in the metadata) # # @raise [ElementNotFoundError] if no matching element is found # @return [Element] # def title # Get the title in the immediate children, not the one in the metadata. Could use # CSS of ":not([data-type='metadata']) > [data-type='document-title'], [data-type='document-title']" # but xpath is shorter first!("./*[@data-type = 'document-title']") end # Returns true if this class represents the element for the given node # # @param node [Nokogiri::XML::Node] the underlying node # @return [Boolean] # def self.is_the_element_class_for?(node) node['data-type'] == 'composite-chapter' end end end
Version data entries
3 entries across 3 versions & 1 rubygems