page_by_page 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 941d892aaaf89b696dfbc8c32024928647e4f4e9
4
- data.tar.gz: 54f4e829f22f5a2006aa385970d18bb9d255afa5
3
+ metadata.gz: 8f4ae9437d8b93ffeae964877df913939a700cfa
4
+ data.tar.gz: 79f64e3d36c7b982aa5bbe2c92222520c83f03ff
5
5
  SHA512:
6
- metadata.gz: ece1b278512a03e7a9a9a9e2854620c77f258ef81478841ec76569100fd16e912051c87240420502637576f254718191eecabe37333e1061970e5c21e9bc694b
7
- data.tar.gz: 7e406c982e29bec4d4d86b6b9349d21bc2a78ed5026c1ada591d5dbc53ff0ecdd11c37fd6bf16afa2b7e27586910e5b639c6e2b84ba4dde37f6f43e9faa38760
6
+ metadata.gz: 65519fdc3814f678b812fa85b7d298352a68a95f998e8eb8a0fd5c1ba775ee192e15d08957639147fa5803691764e9015a7d9d99c55d4f49256bb720988dfb4f
7
+ data.tar.gz: d5025ffd44d32a089c7f709ffebf8af59f4c29cc77a60f2f257d02f5bf2123da6a78b2e807aedd5dd95aa22f7428dd2d4aa8a8789b2b10cb6c2facaeb6afa728
@@ -1,3 +1,3 @@
1
1
  class PageByPage
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/page_by_page.rb CHANGED
@@ -17,18 +17,27 @@ class PageByPage
17
17
  end
18
18
 
19
19
  def url tmpl
20
- @url = Url.new tmpl
20
+ @tmpl = tmpl
21
21
  end
22
22
 
23
23
  def selector sl
24
24
  @selector = sl
25
25
  end
26
26
 
27
+ def from n
28
+ @from = n
29
+ end
30
+
31
+ def step n
32
+ @step = n
33
+ end
34
+
27
35
  def fetch
36
+ url = Url.new @tmpl, options
28
37
  items, all_items = [nil], []
29
38
  catch :no_more do
30
39
  until items.empty?
31
- doc = parse @url.next
40
+ doc = parse url.next
32
41
  items = doc.css @selector
33
42
  all_items << items
34
43
  end
@@ -48,4 +57,11 @@ class PageByPage
48
57
  end
49
58
  end
50
59
 
60
+ def options
61
+ opt = {}
62
+ opt[:from] = @from || 1
63
+ opt[:step] = @step || 1
64
+ opt
65
+ end
66
+
51
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_by_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken