class Juknife::Scraping::DSL::Scope

A DSL node in the tree that makes an scope of element.

Attributes

args[R]
selector[R]

Public Class Methods

new(selector, *args, &block) click to toggle source
# File lib/juknife/scraping/dsl/scope.rb, line 12
def initialize(selector, *args, &block)
  @selector = selector
  @args = args

  return unless block
  instance_eval(&block)
end

Public Instance Methods

visit(context) click to toggle source
# File lib/juknife/scraping/dsl/scope.rb, line 20
def visit(context)
  scope = context.find(selector)

  children.each do |child|
    child.visit(Context.new(scope, context.result))
  end
end