Module: ZK::ZKEventMachine::Unixisms
- Included in:
- Client
- Defined in:
- lib/z_k/z_k_event_machine/unixisms.rb
Instance Method Summary collapse
Instance Method Details
#mkdir_p(paths, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/z_k/z_k_event_machine/unixisms.rb', line 4 def mkdir_p(paths, &block) dfr = Deferred::Default.new.tap do |my_dfr| Iterator.new(Array(paths).flatten.compact, 1).map( lambda { |path,iter| # foreach d = _mkdir_p_dfr(path) d.callback { |p| iter.return(p) } d.errback { |e| my_dfr.fail(e) } }, lambda { |results| my_dfr.succeed(results) } # after completion ) end _handle_calling_convention(dfr, &block) end |
#rm_rf(paths, &blk) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/z_k/z_k_event_machine/unixisms.rb', line 19 def rm_rf(paths, &blk) dfr = Deferred::Default.new.tap do |my_dfr| Iterator.new(Array(paths).flatten.compact, 1).each( lambda { |path,iter| # foreach d = _rm_rf_dfr(path) d.callback { iter.next } d.errback { |e| my_dfr.fail(e) } }, lambda { my_dfr.succeed } # after completion ) end _handle_calling_convention(dfr, &blk) end |