When I try to start dashing I receive the following error:
scheduler caught exception:
uninitialized constant Nokogiri
/Users/Adam/projects/ticker/jobs/sample.rb:2:in `block in <top (required)>'
my Gemfile is:
source 'https://rubygems.org'
gem 'nokogiri'
gem 'dashing'
my jobs folder consists of one folder, sample.rb:
SCHEDULER.every '2s' do
oil_doc = Nokogiri::HTML(open("http://www.bloomberg.com/energy/"))
a = oil_doc.css("table.std_table_module").first
price = a.xpath("//td[3]").first.children.text
send_event('valuation', { current: price })
end
I have tried adding require 'open-uri'
to the Gemfile and sample.rb but it has not helped!
The error message is saying that it doesn't know anything about Nokogiri
, which is a module defined in the nokogiri gem. In order to bring that into scope, you need to add:
require 'nokogiri'
to your sample.rb
(usually at the top of the file).