views:

11

answers:

1

I'm trying to use zookeeper gem and example code from README fails:

require 'rubygems'
require 'zookeeper'
z = Zookeeper.new("localhost:2181")
z.get_children(:path => "/")

causes error:

./zookeeper.rb:3: uninitialized constant Zookeeper (NameError)
 from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
 from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
 from zookeeper.rb:2

I'm googling and looking code and I really have no idea what to do...

+1  A: 

Don't call your file zookeeper.rb .

steenslag
To clarify: When you use `require 'zookeeper'`, it is requiring your file, rather than requiring the zookeeper gem. This is because, in Rubies less than 1.9.2, "." is at the end of the load path.
Greg Campbell