未定义的常量ParseConfig

时间:2015-06-01 18:36:50

标签: ruby

实际上,我正在尝试使用ruby-lint和ruboto来改进我的代码。 ruby-lint说:

  

" get.rb:错误:第89行,第14列:未定义常量ParseConfig"

在那个地方我有标记的代码:

require 'parseconfig'
module PublicanCreatorsGet
 def self.config
    home = Dir.home
    config = ParseConfig.new("#{home}/.publicancreators.cfg") <-------
 end
end

但是什么使这成为一个常数呢?我认为他们很高兴。

2 个答案:

答案 0 :(得分:0)

名称以大写字母(A-Z)开头的变量是常量。

答案 1 :(得分:0)

Ruby将类名称视为常量,如果您真的想要解决可以在模块中尝试遵循的错误

require 'parseconfig'

module PublicanCreatorsGet
  include ParseConfig

   def self.config
       home = Dir.home
       config = ParseConfig.new("#{home}/.publicancreators.cfg")
   end
end
相关问题