class Kitchen::TableElement

An element for a table

Public Class Methods

new(node:, document: nil) click to toggle source

Creates a new TableElement

@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/table_element.rb, line 13
def initialize(node:, document: nil)
  super(node: node,
        document: document,
        enumerator_class: TableElementEnumerator)
end
short_type() click to toggle source

Returns the short type @return [Symbol]

# File lib/kitchen/table_element.rb, line 22
def self.short_type
  :table
end

Public Instance Methods

caption() click to toggle source

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
caption_title() click to toggle source

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
column_header?() click to toggle source

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
title() click to toggle source

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
title_row() click to toggle source

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
top_caption() click to toggle source

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
top_captioned?() click to toggle source

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
top_titled?() click to toggle source

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
unnumbered?() click to toggle source

Returns true if the table is unnumbered

@return [Boolean]

# File lib/kitchen/table_element.rb, line 80
def unnumbered?
  has_class?('unnumbered')
end
unstyled?() click to toggle source

Returns true if the table is unstyled

@return [Boolean]

# File lib/kitchen/table_element.rb, line 88
def unstyled?
  has_class?('unstyled')
end