Closed Ponyboy47 closed 12 years ago
It sounds like you might be writing something like
class SiriProxy::Plugin::Cleverbot < SiriProxy::Plugin
def initialize
@cleverbot = Cleverbot::Client.new
end
# ...
end
The problem here is that your plugin is called SiriProxy::Plugin::Cleverbot
, so Ruby thinks that you are looking for the local class SiriProxy::Plugin::Cleverbot::Client
. What you want to do is add ::
to the front of your Cleverbot::Client
, so the code looks something like this:
class SiriProxy::Plugin::Cleverbot < SiriProxy::Plugin
def initialize
@cleverbot = ::Cleverbot::Client.new
end
# ...
end
The ::
makes Ruby look for the class on the global namespace, instead of the namespace within your plugin.
Also, when you finish your Siri+Cleverbot plugin, post another reply in here so I can check it out.
Thank you for your help. You were right. As soon as I changed it to ::Cleverbot::Client etc.. it worked. I've just uploaded my plugin...here is the link to it https://www.github.com/Ponyboy47/siriproxy-cleverbot
Idk what it is. but for some reason in my program I keep getting this error "uninitialized constant SiriProxy::Plugin::Cleverbot::Client (NameError)" For some reason I get a NameError when calling Cleverbot::Client. And without being able to use Cleverbot::Client I basically can't use any of the functionality of your Cleverbot gem..Is this a common issue? Do you have any idea why I'd be getting this error/troubleshooting I can do? I'm pretty new to coding in Ruby so I'm not sure how to isolate and solve too many errors..