当我尝试开始潇洒时,我收到以下错误:
scheduler caught exception:
uninitialized constant Nokogiri
/Users/Adam/projects/ticker/jobs/sample.rb:2:in `block in <top (required)>'
Run Code Online (Sandbox Code Playgroud)
我的Gemfile是:
source 'https://rubygems.org'
gem 'nokogiri'
gem 'dashing'
Run Code Online (Sandbox Code Playgroud)
我的jobs文件夹包含一个文件夹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
Run Code Online (Sandbox Code Playgroud)
我已经尝试添加 require 'open-uri'到Gemfile和sample.rb但它没有帮助!