class Kitchen::TableElement
An element for a table
Public Class Methods
Creates a new TableElement
@param node [Nokogiri::XML::Node] the node this element wraps @param document [Document] this element's document
Kitchen::ElementBase::new
# File lib/kitchen/table_element.rb, line 13 def initialize(node:, document: nil) super(node: node, document: document, enumerator_class: TableElementEnumerator) end
Returns the short type @return [Symbol]
# File lib/kitchen/table_element.rb, line 22 def self.short_type :table end
Public Instance Methods
Returns an element for the table caption, if present
@return [Element, nil]
# File lib/kitchen/table_element.rb, line 104 def caption first('caption') end
Returns the caption title nodes
@return [Nokogiri::XML::NodeSet]
# File lib/kitchen/table_element.rb, line 63 def caption_title top_caption&.first('span[data-type="title"]')&.children end
Returns true if the table has a column header
@return [Boolean]
# File lib/kitchen/table_element.rb, line 96 def column_header? has_class?('column-header') end
Returns the title nodes in the first title row element
@return [Nokogiri::XML::NodeSet] Unusual to return the raw Nokogiri
nodes!
# File lib/kitchen/table_element.rb, line 38 def title # TODO: replace +children+ with +element_children+? title_row&.first('th')&.children end
Returns an element for the title row, if present
@return [Element, nil]
# File lib/kitchen/table_element.rb, line 30 def title_row top_titled? ? first('thead').first('tr') : nil end
Returns an element for the top caption, if present
@return [Element, nil]
# File lib/kitchen/table_element.rb, line 55 def top_caption top_captioned? ? first('caption') : nil end
Returns true if the table has a caption at the top that transforms to top title
@return [Boolean]
# File lib/kitchen/table_element.rb, line 72 def top_captioned? has_class?('top-captioned') end
Returns true if the table has a title at the top
@return [Boolean]
# File lib/kitchen/table_element.rb, line 47 def top_titled? has_class?('top-titled') end
Returns true if the table is unnumbered
@return [Boolean]
# File lib/kitchen/table_element.rb, line 80 def unnumbered? has_class?('unnumbered') end
Returns true if the table is unstyled
@return [Boolean]
# File lib/kitchen/table_element.rb, line 88 def unstyled? has_class?('unstyled') end