Class: PageByPage::Fetch
- Inherits:
-
Object
show all
- Includes:
- Common
- Defined in:
- lib/page_by_page/fetch.rb
Instance Method Summary
collapse
Methods included from Common
#header, #interval, #no_progress, #selector, #to
Constructor Details
#initialize(opt = {}, &block) ⇒ Fetch
Returns a new instance of Fetch.
11
12
13
14
|
# File 'lib/page_by_page/fetch.rb', line 11
def initialize(opt = {}, &block)
@from, @step, @to = 1, 1, Float::INFINITY
super
end
|
Instance Method Details
#from(n) ⇒ Object
20
21
22
|
# File 'lib/page_by_page/fetch.rb', line 20
def from n
@from = n
end
|
#process ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/page_by_page/fetch.rb', line 32
def process
nodes_2d =
unless defined? @threads
@enum = Enum.new enum_options
_fetch
else
@enum = MutexEnum.new enum_options
parallel_fetch
end
puts if @progress
nodes_2d.reject(&:nil?).flatten
end
|
#step(n) ⇒ Object
24
25
26
|
# File 'lib/page_by_page/fetch.rb', line 24
def step n
@step = n
end
|
#threads(n) ⇒ Object
28
29
30
|
# File 'lib/page_by_page/fetch.rb', line 28
def threads n
@threads = n
end
|
#url(tmpl) ⇒ Object
16
17
18
|
# File 'lib/page_by_page/fetch.rb', line 16
def url tmpl
@tmpl = ERB.new tmpl
end
|