Sha256: 1106c2a624c4947c79d00758f05ea767f86493dacd40d3a35957bb74659ad1c4

Contents?: true

Size: 368 Bytes

Versions: 4

Compression:

Stored size: 368 Bytes

Contents

class CommentsInfoParser

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

  def parse
    comments_info = nil
    if @element
      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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-hackernews-1.1.1 lib/ruby-hackernews/services/parsers/comments_info_parser.rb
ruby-hackernews-1.1.0 lib/ruby-hackernews/services/parsers/comments_info_parser.rb
ruby-hackernews-1.0.1 lib/ruby-hackernews/services/parsers/comments_info_parser.rb
ruby-hackernews-1.0.0 lib/HNAPI/services/parsers/comments_info_parser.rb