class Kitchen::ExerciseElement

An element for an example

Public Class Methods

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

Creates a new ExerciseElement

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

Returns the short type @return [Symbol]

# File lib/kitchen/exercise_element.rb, line 22
def self.short_type
  :exercise
end

Public Instance Methods

baked?() click to toggle source

Returns whether the exercise has been baked

@return [Boolean]

# File lib/kitchen/exercise_element.rb, line 54
def baked?
  search('div.os-problem-container').any?
end
problem() click to toggle source

Returns the enumerator for problem.

@return ElementEnumerator

# File lib/kitchen/exercise_element.rb, line 30
def problem
  first("div[data-type='problem']")
end
solution() click to toggle source

Returns the enumerator for solution.

@return ElementEnumerator

# File lib/kitchen/exercise_element.rb, line 38
def solution
  first("div[data-type='solution']")
end
solutions() click to toggle source

Returns the enumerator for solutions

@return [ElementEnumerator]

# File lib/kitchen/exercise_element.rb, line 46
def solutions
  search("div[data-type='solution']")
end