Ruby 新手求助:"undefined local variable or method"问题

knight_06 · 2012年05月18日 · 5173 次阅读

本人刚接触 Ruby 纯小白。在运行一个.rb 时遇到如下错误: /usr/lib/one/sunstone/sunstone-server.rb:78: undefined local variable or method `settings' for main:Object (NameError)

查看该代码相应位置:

begin
    conf = YAML.load_file(CONFIGURATION_FILE)
rescue Exception => e
    STDERR.puts "Error parsing config file #{CONFIGURATION_FILE}: #{e.message}"
    exit 1
end

conf[:debug_level] ||= 3

CloudServer.print_configuration(conf)

set :config, conf
set :bind, settings.config[:host]
set :port, settings.config[:port]

请教各位高手:错误中提示未定义的`settings' 是什么原因?是有对应的包没有安装吗?还是需要自己定义这个变量呢?如何定义?

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号