Module: Botz

Extended by:
ActiveSupport::Autoload
Defined in:
lib/botz.rb,
lib/botz/version.rb

Overview

web bot dsl engine

Defined Under Namespace

Modules: ResourceAccessor, Scraper Classes: Console, Definition, DefinitionFile, Shell, Spider

Constant Summary collapse

VERSION =
'0.4.0'

Class Method Summary collapse

Class Method Details

.consoleObject



23
24
25
26
# File 'lib/botz.rb', line 23

def self.console
  require 'pry'
  Pry.start(Botz::Console.new)
end

.define(name, domain: nil, &block) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/botz.rb', line 32

def self.define(name, domain: nil, &block)
  crawler_definition = Class.new(::Botz::Definition, &block)
  crawler_definition.domain = domain
  crawler_class_name = name.to_s.camelize

  Crawler.class_eval { remove_const(crawler_class_name) } if Crawler.const_defined?(crawler_class_name)
  Crawler.const_set(crawler_class_name, crawler_definition)
  crawler_definition
end

.open(filepath) ⇒ Object



28
29
30
# File 'lib/botz.rb', line 28

def self.open(filepath)
  ::Botz::DefinitionFile.open(filepath)
end