hack3rnews 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hack3rnews.rb +10 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dc1c348fab112a324ae441e4310a69484572aa3a8500fe3bbef7075e713b331
4
- data.tar.gz: daca0d8d89d6548ee506688168f2fd60eb76e14a98abe226712e41e673e8a104
3
+ metadata.gz: 82e9fe3f6cc5f6fa373cae0c63a4058114bb417de0d91a0c55fad23fb1de445a
4
+ data.tar.gz: 4e696613d05b3b9682e131d4a0b1f494549ba2a0a7c89be06301b6c3ff063ec6
5
5
  SHA512:
6
- metadata.gz: 38fe1eafd2327457ffcd5d6637a779c9efc6c47445d478e688f4b034c0c3340046a36236b0968eafab2b4b5917dd9da2211ca685b335a2e9e8ba23f75c414087
7
- data.tar.gz: 9684b38fd27da616932b4c7fa8777c9e37c5264d4540c80840bdd8ca4fe1335c468bb9b802f305ac7d64abcbb40d92da691d5cc01797913ee95589171911b237
6
+ metadata.gz: f528de6bcafaaff9da60e90d2ce4392af3446ca819942d24f7b62d5a8cd1fc8f832b44f65f7f42bbb17c7fc921bff2ae880535fd92262957e187a476eb5217c9
7
+ data.tar.gz: 8458a45c5e0dbf386da32bc42aa8ced08b8397a106467002cef97e6354230de05cccbcdfc9fc9031a0e2c4c912655c30c49820d0ab632ff054850ce9dc1f95e5
data/lib/hack3rnews.rb CHANGED
@@ -33,13 +33,9 @@ class HackerNew
33
33
 
34
34
  private
35
35
  def capture_item_kids(type, opt = {})
36
- kids = []
37
36
  item = request_item(type, opt[:item_id])
38
37
  kid_ids = capture_ids(item, opt)
39
- while kid_id = kid_ids.shift
40
- kids << request_item('item', kid_id)
41
- end
42
- kids
38
+ capture_items(kid_ids)
43
39
  end
44
40
 
45
41
  def capture_ids(item, opt)
@@ -49,12 +45,16 @@ class HackerNew
49
45
  end
50
46
 
51
47
  def capture_stories(type, num)
52
- stories = []
53
- storie_ids = request_bunch(type, num)
54
- while story_id = storie_ids.shift
55
- stories << request_item('item', story_id)
48
+ story_ids = request_bunch(type, num)
49
+ capture_items(story_ids)
50
+ end
51
+
52
+ def capture_items(item_ids)
53
+ items = []
54
+ while item_id = item_ids.shift
55
+ items << request_item('item', item_id)
56
56
  end
57
- stories
57
+ items
58
58
  end
59
59
 
60
60
  def request(url)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hack3rnews
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alvaro Padilla