Class: MMonitor::Crawler
- Inherits:
-
Object
- Object
- MMonitor::Crawler
- Defined in:
- lib/mmonitor/crawler.rb
Overview
爬虫,负责数据抓取流程
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#page ⇒ Object
Returns the value of attribute page.
-
#page_key ⇒ Object
Returns the value of attribute page_key.
-
#pages ⇒ Object
Returns the value of attribute pages.
-
#params ⇒ Object
Returns the value of attribute params.
-
#total ⇒ Object
Returns the value of attribute total.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ Crawler
constructor
A new instance of Crawler.
- #items ⇒ Object
Constructor Details
#initialize(url) ⇒ Crawler
Returns a new instance of Crawler.
9 10 11 12 13 |
# File 'lib/mmonitor/crawler.rb', line 9 def initialize(url) self.page = 1 self.page_key = 'page' process(url) end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
7 8 9 |
# File 'lib/mmonitor/crawler.rb', line 7 def adapter @adapter end |
#page ⇒ Object
Returns the value of attribute page.
7 8 9 |
# File 'lib/mmonitor/crawler.rb', line 7 def page @page end |
#page_key ⇒ Object
Returns the value of attribute page_key.
7 8 9 |
# File 'lib/mmonitor/crawler.rb', line 7 def page_key @page_key end |
#pages ⇒ Object
Returns the value of attribute pages.
7 8 9 |
# File 'lib/mmonitor/crawler.rb', line 7 def pages @pages end |
#params ⇒ Object
Returns the value of attribute params.
7 8 9 |
# File 'lib/mmonitor/crawler.rb', line 7 def params @params end |
#total ⇒ Object
Returns the value of attribute total.
7 8 9 |
# File 'lib/mmonitor/crawler.rb', line 7 def total @total end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/mmonitor/crawler.rb', line 7 def url @url end |
Instance Method Details
#items ⇒ Object
15 16 17 |
# File 'lib/mmonitor/crawler.rb', line 15 def items self.adapter.items end |