lib/rio/ops/dir.rb in rio-0.3.3 vs lib/rio/ops/dir.rb in rio-0.3.4
- old
+ new
@@ -120,11 +120,11 @@
module RIO
module Ops
module Dir
module Existing
def selective?
- %w[sel nosel stream_sel stream_nosel].any? { |k| cx.has_key?(k) }
+ %w[entry_sel stream_sel stream_nosel].any? { |k| cx.has_key?(k) }
end
def mkdir(*args) self end
def mkpath(*args) self end
def rmdir(*args)
Impl::U.rmdir(self,*args);
@@ -176,11 +176,11 @@
include Grande
include Cp::Dir::Input
include Cp::Dir::Output
public
- def entries(*args,&block) _set_select('entries','sel',:true?,*args,&block) end
+ def entries(*args,&block) _set_select('entries',*args,&block) end
def each(*args,&block)
# p callstr('each',*args)
each_(*args,&block)
end
@@ -215,14 +215,20 @@
else
self.close if closeoneof?
nil
end
end
-
+ def handle_skipped
+ #return unless cx.has_key?('skip_args') or cx['skipping']
+ return self unless cx.has_key?('skip_args')
+ args = cx['skip_args'] || []
+ self.skipentries(*args)
+ end
def each_(*args,&block)
#p "#{callstr('each_',*args)} sel=#{cx['sel'].inspect} nosel=#{cx['nosel'].inspect}"
- sel = Match::Entry::Selector.new(cx['sel'],cx['nosel'])
+ handle_skipped()
+ sel = Match::Entry::Selector.new(cx['entry_sel'])
selfstr = (self.to_s == '.' ? nil : self.to_s)
self.ioh.each do |estr|
next if estr =~ /^\.(\.)?$/
begin
erio = new_rio_cx(selfstr ? Impl::U.join(selfstr,estr) : estr )
@@ -232,11 +238,11 @@
else
yield _add_iter_cx(erio) if sel.match?(erio)
end
if cx.has_key?('all') and erio.directory?
- rsel = Match::Entry::Selector.new(cx['r_sel'],cx['r_nosel'])
+ rsel = Match::Entry::SelectorClassic.new(cx['r_sel'],cx['r_nosel'])
_add_recurse_iter_cx(erio).each(&block) if rsel.match?(erio)
end
rescue ::Errno::ENOENT, ::URI::InvalidURIError => ex
$stderr.puts(ex.message+". Skipping.")
@@ -275,10 +281,10 @@
next unless cx.has_key?(k)
new_cx.set_(k,cx[k])
}
ario.cx = new_cx
end
- CX_DIR_ITER_KEYS = %w[sel nosel]
+ CX_DIR_ITER_KEYS = %w[entry_sel]
CX_STREAM_ITER_KEYS = %w[stream_rectype stream_itertype stream_sel stream_nosel]
def _add_iter_cx(ario)
if nostreamenum?
_add_cx(ario,CX_DIR_ITER_KEYS)
end