class Kitchen::UnitElement
An element for a unit
Public Class Methods
new(node:, document: nil)
click to toggle source
Creates a new UnitElement
@param node [Nokogiri::XML::Node] the node this element wraps @param document [Document] this element's document
Calls superclass method
Kitchen::ElementBase::new
# File lib/kitchen/unit_element.rb, line 13 def initialize(node:, document: nil) super(node: node, document: document, enumerator_class: UnitElementEnumerator) end
short_type()
click to toggle source
Returns the short type @return [Symbol]
# File lib/kitchen/unit_element.rb, line 22 def self.short_type :unit end
Public Instance Methods
title()
click to toggle source
Get the title in the immediate children, not the one in the metadata. Could use CSS of “:not() >
[data-type='document-title'], [data-type='document-title']"
but xpath is shorter @return [Element]
# File lib/kitchen/unit_element.rb, line 32 def title first!("./*[@data-type = 'document-title']") end
title_text()
click to toggle source
Returns the title's text regardless of whether the title has been baked
@return [String]
# File lib/kitchen/unit_element.rb, line 40 def title_text title.children.one? ? title.text : title.first('.os-text').text end