Sha256: 1f426c53434a911d48d9b142a63155e6d2f7be2b960d7b0dea6dec87a7e37e57

Contents?: true

Size: 747 Bytes

Versions: 4

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

require_relative 'dsl/item'
require_relative 'dsl/items'
require_relative 'dsl/scope'

module Juknife
  module Scraping
    # A DSL for definition scraping items on the web page.
    module DSL
      autoload :Item, 'juknife/scraping/dsl/item'
      autoload :Items, 'juknife/scraping/dsl/items'
      autoload :Scope, 'juknife/scraping/dsl/scope'

      def item(name, *args, &block)
        children << Item.new(name, *args, &block)
      end

      def items(name, *args, &block)
        children << Items.new(name, *args, &block)
      end

      def scope(name, *args, &block)
        children << Scope.new(name, *args, &block)
      end

      def children
        @children ||= []
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
juknife-0.2.0 lib/juknife/scraping/dsl.rb
juknife-0.1.3 lib/juknife/scraping/dsl.rb
juknife-0.1.2 lib/juknife/scraping/dsl.rb
juknife-0.1.1 lib/juknife/scraping/dsl.rb