ruby-hackernews 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ require 'rake/testtask'
8
8
 
9
9
  spec = Gem::Specification.new do |s|
10
10
  s.name = 'ruby-hackernews'
11
- s.version = '1.1.1'
11
+ s.version = '1.1.2'
12
12
  s.add_dependency('require_all', '>= 1.1.0')
13
13
  s.add_dependency('mechanize', '>= 1.0.0')
14
14
  s.has_rdoc = false
@@ -25,4 +25,4 @@ Rake::GemPackageTask.new(spec) do |p|
25
25
  p.gem_spec = spec
26
26
  p.need_tar = true
27
27
  p.need_zip = true
28
- end
28
+ end
@@ -9,8 +9,8 @@ class CommentsInfo
9
9
  @page = page
10
10
  end
11
11
 
12
- def id
12
+ def id
13
13
  return page[/\d+/]
14
14
  end
15
15
 
16
- end
16
+ end
@@ -43,7 +43,7 @@ class Entry
43
43
  end
44
44
 
45
45
  def id
46
- return @comments_info.id
46
+ return @comments_info ? @comments_info.id : nil
47
47
  end
48
48
 
49
49
  def comments_count
@@ -62,4 +62,4 @@ class Entry
62
62
  return VotingService.new.vote(@voting.upvote)
63
63
  end
64
64
 
65
- end
65
+ end
@@ -6,11 +6,11 @@ class CommentsInfoParser
6
6
 
7
7
  def parse
8
8
  comments_info = nil
9
- if @element
9
+ if @element && @element['href'] =~ /id/
10
10
  comments = @element.inner_html.split[0].to_i
11
11
  comments_page = @element['href']
12
12
  comments_info = CommentsInfo.new(comments, comments_page)
13
13
  end
14
14
  return comments_info
15
15
  end
16
- end
16
+ end
@@ -16,4 +16,4 @@ class EntryParser
16
16
  return Entry.new(number, link, voting, user, comments, time)
17
17
  end
18
18
 
19
- end
19
+ end
@@ -5,4 +5,10 @@ require 'mechanize'
5
5
  require 'require_all'
6
6
 
7
7
  require_all File.join(File.dirname(__FILE__), 'ruby-hackernews', 'domain')
8
- require_all File.join(File.dirname(__FILE__), 'ruby-hackernews', 'services')
8
+ require_all File.join(File.dirname(__FILE__), 'ruby-hackernews', 'services')
9
+
10
+ entries = Entry.all(2)
11
+
12
+ entries.each do |entry|
13
+ p entry.id, entries.index(entry)
14
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-hackernews
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 1
9
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Andrea Dallera
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-06-08 00:00:00 +02:00
18
+ date: 2011-09-09 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,6 +26,7 @@ dependencies:
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
29
+ hash: 19
28
30
  segments:
29
31
  - 1
30
32
  - 1
@@ -40,6 +42,7 @@ dependencies:
40
42
  requirements:
41
43
  - - ">="
42
44
  - !ruby/object:Gem::Version
45
+ hash: 23
43
46
  segments:
44
47
  - 1
45
48
  - 0
@@ -95,6 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
98
  requirements:
96
99
  - - ">="
97
100
  - !ruby/object:Gem::Version
101
+ hash: 3
98
102
  segments:
99
103
  - 0
100
104
  version: "0"
@@ -103,6 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
107
  requirements:
104
108
  - - ">="
105
109
  - !ruby/object:Gem::Version
110
+ hash: 3
106
111
  segments:
107
112
  - 0
108
113
  version: "0"