其实我正在试验ruby-lint和ruboto来改进我的代码。红宝石皮棉说:未定义常量ParseConfig
"get.rb: error: line 89, column 14: undefined constant ParseConfig"
在那个地方,我有标记代码:
require 'parseconfig'
module PublicanCreatorsGet
def self.config
home = Dir.home
config = ParseConfig.new("#{home}/.publicancreators.cfg") <-------
end
end
但是是什么让这一个常数?我以为他们已经过了。
错误真的意味着该类没有被发现在继错误。类名在技术上是常数。按照红宝石惯例,常量必须用大写字母开头,不一定全是资本;类和模块并不全是上限。 http://rubylearning.com/satishtalim/ruby_constants.html –
非常感谢您澄清:-) –
我不能重复这个问题?如果我需要'parseconfig',我可以毫无问题地访问顶级常量'ParseConfig'。 – engineersmnky