Sha256: dce6dc28c1f0581658e0e7281b1c4cbe5b4592d5edd0ccb81567604d1df9b85e
Contents?: true
Size: 615 Bytes
Versions: 4
Compression:
Stored size: 615 Bytes
Contents
# frozen_string_literal: true module Juknife module Scraping module DSL # A DSL node in the tree that makes an scope of element. class Scope include DSL attr_reader :selector, :args def initialize(selector, *args, &block) @selector = selector @args = args return unless block instance_eval(&block) end def visit(context) scope = context.find(selector) children.each do |child| child.visit(Context.new(scope, context.result)) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems