Sha256: be377fa9684ece2c088da8024b8d38df26c9680f8af7058fef4cda7ebb17510c
Contents?: true
Size: 496 Bytes
Versions: 2
Compression:
Stored size: 496 Bytes
Contents
module RubyHackernews class CommentsInfoParser def initialize(second_line) @second_line = second_line end def parse return unless comments_link comments = comments_link.text.split[0].to_i comments_page = comments_link['href'] CommentsInfo.new(comments, comments_page) end private def comments_link links.find { |link| link.text =~ /comment|discuss/ } end def links @second_line.css('a') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-hackernews-1.4.0 | lib/ruby-hackernews/services/parsers/comments_info_parser.rb |
ruby-hackernews-1.3.7 | lib/ruby-hackernews/services/parsers/comments_info_parser.rb |