lib/quorable.rb in quorable-0.1.7 vs lib/quorable.rb in quorable-0.1.8

- old
+ new

@@ -1,19 +1,18 @@ require 'open-uri' require 'nokogiri' require 'pry' module Quorable - BASE_URL = 'http://www.quora.com' + 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| "#{BASE_URL}#{link['href']}" } - paths + doc = Nokogiri::HTML.parse(open("#{URL}/#{Quorable.parameterize(topic)}")) + doc.css('.question_link').map { |link| "#{URL}#{link['href']}" } end private def self.parameterize(topic) - topic.split(' ').map(&:downcase).map(&:capitalize).join('-') + topic.split.map(&:capitalize).join('-') end end \ No newline at end of file