Module: Crawler

Included in:
BNextRobot
Defined in:
lib/int_module/crawl_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#catsObject

Returns the value of attribute cats.



5
6
7
# File 'lib/int_module/crawl_runner.rb', line 5

def cats
  @cats
end

#domainObject

Returns the value of attribute domain.



5
6
7
# File 'lib/int_module/crawl_runner.rb', line 5

def domain
  @domain
end

#web_dataObject

Returns the value of attribute web_data.



5
6
7
# File 'lib/int_module/crawl_runner.rb', line 5

def web_data
  @web_data
end

Instance Method Details

#analyzeObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/int_module/crawl_runner.rb', line 18

def analyze
    raise NotImplementedError.new("#{self.class.name}#analyze is an abstract method.")
end

#get_feeds(cat, max_num) ⇒ Object

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/int_module/crawl_runner.rb', line 22

def get_feeds( cat, max_num )
    raise NotImplementedError.new("#{self.class.name}#get_feeds is an abstract method.")
end

#load_page(url) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/int_module/crawl_runner.rb', line 7

def load_page( url )
    begin
        @domain = url
        @domain += "/" unless @domain.end_with? "/"
        open( url ) { |f| @web_data = f.read }
        1
    rescue
        0
    end
end