Sha256: 5ae2b8dec62a687e7512e320e00ef042e21c64ae7a3bf7d53b5fbfcc579392ea

Contents?: true

Size: 454 Bytes

Versions: 6

Compression:

Stored size: 454 Bytes

Contents

module RubyHackernews

  class CommentsInfoParser

    def initialize(comments_element)
      @element = comments_element.search("a")[1]
    end

    def parse
      comments_info = nil
      if @element && @element['href'] =~ /id/
        comments      = @element.inner_html.split[0].to_i
        comments_page = @element['href']
        comments_info = CommentsInfo.new(comments, comments_page)
      end
      return comments_info
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-hackernews-1.3.6 lib/ruby-hackernews/services/parsers/comments_info_parser.rb
ruby-hackernews-1.3.5 lib/ruby-hackernews/services/parsers/comments_info_parser.rb
ruby-hackernews-1.3.3 lib/ruby-hackernews/services/parsers/comments_info_parser.rb
ruby-hackernews-1.3.2 lib/ruby-hackernews/services/parsers/comments_info_parser.rb
ruby-hackernews-1.3.1 lib/ruby-hackernews/services/parsers/comments_info_parser.rb
ruby-hackernews-1.3.0 lib/ruby-hackernews/services/parsers/comments_info_parser.rb