Sha256: 5ee014610173aa69334fa37f07a7ff50ce996c04cb64843569d780ab5a2ec7a1

Contents?: true

Size: 402 Bytes

Versions: 1

Compression:

Stored size: 402 Bytes

Contents

require 'open-uri'
require 'nokogiri'
require 'pry'

module Quorable
  BASE_URL = 'http://www.quora.com'

  def self.feed(topic)
    doc = Nokogiri::HTML.parse(open("#{BASE_URL}/#{Quorable.parameterize(topic)}"))
    paths = doc.css('.question_link').map { |link| link['href'] }
  end

  private

  def self.parameterize(topic)
    topic.split(' ').map(&:downcase).map(&:capitalize).join('-')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quorable-0.1.4 lib/quorable.rb