Class: Kitchen::Element

Inherits:
ElementBase show all
Defined in:
lib/kitchen/element.rb

Overview

An one-off element that isn’t one of the main elements we have dedicated classes for (like ChapterElement). Provides a way to set an arbitrary short_type

Instance Attribute Summary

Attributes inherited from ElementBase

#ancestors, #document, #enumerator_class, #search_query_that_found_me, #short_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ElementBase

#[], #[]=, #add_ancestor, #add_ancestors, #add_class, #ancestor, #ancestor_elements, #append, #as_enumerator, #children, #classes, #clone, #config, #contains?, #content, #copied_id, #copy, #count_in, #cut, #data_type, descendant, descendant!, #element_children, #first, #first!, #has_ancestor?, #has_class?, #href, #href=, #id, #id=, #inner_html=, #inspect, #is?, #key?, #mark_as_current_location!, #name, #name=, #pages, #pantry, #parent, #paste, #path, #preceded_by_text, #prepend, #previous, #raw, #raw_search, #remember_that_a_sub_element_was_counted, #remove_attribute, #remove_class, #replace_children, #search, #search_history, #selectors, #set, #sub_header_name, #target_label, #text, #to_html, #to_s, #to_xhtml, #to_xml, #trash, #uncount, #wrap, #wrap_children

Methods included from Mixins::BlockErrorIf

#block_error_if

Constructor Details

#initialize(node:, document:, short_type: nil) ⇒ Element

Creates a new Element

Parameters:

  • node (Nokogiri::XML::Node)

    the node this element wraps

  • document (Document)

    this element’s document

  • short_type (Symbol, String) (defaults to: nil)

    the type for this element



15
16
17
18
19
20
# File 'lib/kitchen/element.rb', line 15

def initialize(node:, document:, short_type: nil)
  super(node: node,
        document: document,
        enumerator_class: ElementEnumerator,
        short_type: short_type)
end

Class Method Details

.is_the_element_class_for?(_node) ⇒ Boolean

Returns true if this class represents the element for the given node; always false for this generic class

Parameters:

Returns:

  • (Boolean)


28
29
30
# File 'lib/kitchen/element.rb', line 28

def self.is_the_element_class_for?(_node, **)
  false
end