I have small piece of ruby code that fetches news from a website that doesn't provide the facility itself. I would like to display the results in a view but I'm not sure where I should store the logic for the code i.e. helper, model (or lib)?
Looking for some guidance on the pros/cons of each and which choice is the most logical.
require 'nokogiri'
require 'open-uri'
require 'json'
news = []
domain = ""
councilnews = Nokogiri::HTML(open(domain + ""))
councilnews.css('p.newsTitle').select do |article|
headline = article.text
link = domain + article.css('a').attribute('href').to_s
content = article.next_element.text
newsItem = {headline: headline, link: link, content: content}
news.push(newsItem.to_json)
end