Skip to content

Commit

Permalink
added a whole mess of documentation to Client
Browse files Browse the repository at this point in the history
  • Loading branch information
slyphon committed Feb 17, 2011
1 parent 7917b2a commit ee7a04e
Show file tree
Hide file tree
Showing 5 changed files with 525 additions and 31 deletions.
11 changes: 11 additions & 0 deletions Rakefile
@@ -1,2 +1,13 @@
require 'bundler'
Bundler::GemHelper.install_tasks

require 'rubygems'
gem 'rdoc', '~> 2.5'
require 'rdoc/task'

RDoc::Task.new do |rd|
rd.title = 'ZK Documentation'
rd.rdoc_files.include("lib/**/*.rb")
end


12 changes: 12 additions & 0 deletions lib/z_k.rb
@@ -1,3 +1,6 @@
require 'rubygems'
require 'bundler/setup'

require 'logger'
require 'zookeeper'
require 'forwardable'
Expand All @@ -19,14 +22,21 @@
module ZK
ZK_ROOT = File.expand_path('../..', __FILE__)

# The logger used by the ZK library. uses a Logger to +/dev/null+ by default
#
def self.logger
@logger ||= Logger.new('/dev/null')
end

# Assign the Logger instance to be used by ZK
def self.logger=(logger)
@logger = logger
end

# Create a new ZK::Client instance. If no arguments are given, the default
# config of 'localhost:2181' will be used. Otherwise all args will be passed
# to ZK::Client#new
#
def self.new(*args)
# XXX: might need to do some param parsing here

Expand All @@ -37,6 +47,8 @@ def self.new(*args)
Client.new(*args)
end

# Like new, yields a connection to the given block and closes it when the
# block returns
def self.open(*args)
cnx = new(*args)
yield cnx
Expand Down

0 comments on commit ee7a04e

Please sign in to comment.