Sha256: 104e327f5732982eaef3b7cfd674355f46a8e861dc256c6a2b8faae9061b7271

Contents?: true

Size: 567 Bytes

Versions: 8

Compression:

Stored size: 567 Bytes

Contents

class EntryPageParser

  def initialize(page)
    @page = page
  end

  def get_lines
    lines = @page.search("//table")[2].search("tr").select do |tr|
      tr['style'] !~ /height/ &&
      tr.children.first.attributes.count != 0
    end
    more_link = lines.last.search("a").first
    lines.pop if more_link && more_link.inner_html == "More"
    return lines
  end

  def get_next_url
    more_link = @page.search("//table")[2].search("tr/td/a").select { |node| node.inner_html == "More"}.first
    return more_link['href'] if more_link
    return nil
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby-hackernews-1.2.1 lib/ruby-hackernews/services/parsers/entry_page_parser.rb
ruby-hackernews-1.2.0 lib/ruby-hackernews/services/parsers/entry_page_parser.rb
ruby-hackernews-1.1.3 lib/ruby-hackernews/services/parsers/entry_page_parser.rb
ruby-hackernews-1.1.2 lib/ruby-hackernews/services/parsers/entry_page_parser.rb
ruby-hackernews-1.1.1 lib/ruby-hackernews/services/parsers/entry_page_parser.rb
ruby-hackernews-1.1.0 lib/ruby-hackernews/services/parsers/entry_page_parser.rb
ruby-hackernews-1.0.1 lib/ruby-hackernews/services/parsers/entry_page_parser.rb
ruby-hackernews-1.0.0 lib/HNAPI/services/parsers/entry_page_parser.rb