Sha256: 603fdc5c0d1f0c0bea9879e18be2166ad50544cd28945abe8c5c50f5d4f3a19f
Contents?: true
Size: 1.02 KB
Versions: 16
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true require 'aranha/dom_elements_traverser/conditions' require 'aranha/dom_elements_traverser/data' require 'aranha/dom_elements_traverser/cursor' module Aranha class DomElementsTraverser include ::Aranha::DomElementsTraverser::Conditions include ::Aranha::DomElementsTraverser::Cursor include ::Aranha::DomElementsTraverser::Data class << self def traverse(options, &block) new(elements_from_options(options), &block) end def empty new([]) end private def elements_from_options(options) options = ::EacRubyUtils::OptionsConsumer.new(options) elements = nil options.consume(:children_of) { |v| elements = v.children.to_a } raise 'None option of [:children_of] defined' unless elements options.validate elements end end private def initialize(elements, &block) @elements = elements @index = 0 @data = {} instance_eval(&block) if block end end end
Version data entries
16 entries across 16 versions & 1 rubygems