【发布时间】:2013-04-20 14:34:26
【问题描述】:
我使用 bundler 创建了一个自定义 gem,并在 git repo 中检查了它。
custom_gem.rb
require "custom_gem/version"
require "custom_gem/custom_class"
module CustomGem
# Your code goes here...
end
custom_class.rb
require 'typhoeus'
module CustomGem
class CustomClass
def self.custom_method
#do stuff with typhoeus
end
end
end
将其作为依赖项添加到另一个项目并通过捆绑程序安装。
gem 'custom_gem', :git => 'git@bitbucket.org:dir/repo.git'
之后我尝试通过调用来使用它
CustomGem::CustomClass.custom_method
我收到以下错误:
未初始化的常量 CustomGem::CustomClass
有什么建议吗?
可能是一件小事,但只是从 ruby 开始,所以任何建议都会很棒。
【问题讨论】: