Sha256: a8f7576a862fd1258abb2b9c60c8f9a05e504aa681d6df2ac61c4833c72631bb
Contents?: true
Size: 933 Bytes
Versions: 11
Compression:
Stored size: 933 Bytes
Contents
# frozen_string_literal: true 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
11 entries across 11 versions & 1 rubygems