Sha256: a96ed57ce225e2c8a55db016d71181cf9b155de57f7976ccea130f61af4ac5eb
Contents?: true
Size: 976 Bytes
Versions: 16
Compression:
Stored size: 976 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/options_consumer' module Aranha class DomElementsTraverser module Cursor private def current @elements[@index] end def skip @index += 1 end def skip_until(options) oc = ::EacRubyUtils::OptionsConsumer.new(options) optional = oc.consume(:optional, false) while current break if match_conditions?(oc.left_data) skip end raise "No element found for conditions #{oc.left_data}" unless current || optional current end def skip_until_after(conditions) skip_until(conditions) skip current end def if_found(conditions, &block) marked = @index skip_until({ optional: true }.merge(conditions)) if current instance_eval(&block) if block else @index = marked end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems