Module: Botz

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

Overview

web bot dsl engine

Defined Under Namespace

Modules: Connector Classes: Binder, Console, Definition, DefinitionFile, Looper, Result, Shell, Spider

Constant Summary collapse

VERSION =
'0.6.0'

Class Method Summary collapse

Class Method Details

.consoleObject



25
26
27
28
# File 'lib/botz.rb', line 25

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

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



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

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



30
31
32
# File 'lib/botz.rb', line 30

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