Sha256: 90ee7cf8c1a6119034f30e57c2b27bab5db0e9bab265a5238b1c3e6e3a88772c

Contents?: true

Size: 878 Bytes

Versions: 10

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

module Kitchen
  # An element for an example
  #
  class ExerciseElement < ElementBase

    # Creates a new +ExerciseElement+
    #
    # @param node [Nokogiri::XML::Node] the node this element wraps
    # @param document [Document] this element's document
    #
    def initialize(node:, document: nil)
      super(node: node,
            document: document,
            enumerator_class: ExerciseElementEnumerator)
    end

    # Returns the short type
    # @return [Symbol]
    #
    def self.short_type
      :exercise
    end

    # Returns the enumerator for problem.
    #
    # @return ElementEnumerator
    #
    def problem
      first("div[data-type='problem']")
    end

    # Returns the enumerator for solution.
    #
    # @return ElementEnumerator
    #
    def solution
      first("div[data-type='solution']")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
openstax_kitchen-9.2.0 lib/kitchen/exercise_element.rb
openstax_kitchen-9.1.0 lib/kitchen/exercise_element.rb
openstax_kitchen-9.0.0 lib/kitchen/exercise_element.rb
openstax_kitchen-8.0.1 lib/kitchen/exercise_element.rb
openstax_kitchen-8.0.0 lib/kitchen/exercise_element.rb
openstax_kitchen-7.0.0 lib/kitchen/exercise_element.rb
openstax_kitchen-6.1.0 lib/kitchen/exercise_element.rb
openstax_kitchen-6.0.0 lib/kitchen/exercise_element.rb
openstax_kitchen-5.0.0 lib/kitchen/exercise_element.rb
openstax_kitchen-4.1.1 lib/kitchen/exercise_element.rb