Module: ZK::Find
- Defined in:
- lib/zk/find.rb
Class Method Summary collapse
-
.find(zk, *paths) {|String| ... } ⇒ Object
like ruby's Find module, will call the given block with each absolute znode path under +paths+.
- .prune ⇒ Object
Class Method Details
.find(zk, *paths) {|String| ... } ⇒ Object
like ruby's Find module, will call the given block with each absolute znode path under +paths+. you can call ZK::Find.prune if you want to not recurse deeper under the current directory path.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/zk/find.rb', line 9 def find(zk, *paths) paths.collect!{|d| d.dup} while p = paths.shift catch(:prune) do yield p.dup.taint next unless zk.exists?(p) zk.children(p).sort.reverse.each do |ch| paths.unshift ZK.join(p, ch).untaint end end end end |
.prune ⇒ Object
24 25 26 |
# File 'lib/zk/find.rb', line 24 def prune throw :prune end |