lib/rio/grande.rb in rio-0.3.3 vs lib/rio/grande.rb in rio-0.3.4

- old
+ new

@@ -73,79 +73,5 @@ end end end end -module RIO - module Grande - module Dir - - 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']) - 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 ) - - if stream_iter? - _add_stream_iter_cx(erio).each(&block) if erio.file? and sel.match?(erio) - else - yield _add_iter_cx(erio) if sel.match?(erio) - end - - if cx.has_key?('all') and erio.dir? - rsel = Match::Entry::Selector.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.") - end - end - closeoneof? ? self.close.softreset : self - end - - - - private - - def _ss_keys() Cx::SS::ENTRY_KEYS + Cx::SS::STREAM_KEYS end - CX_ALL_SKIP_KEYS = ['retrystate'] - def _add_recurse_iter_cx(ario) - new_cx = ario.cx - cx.keys.reject { |k| CX_ALL_SKIP_KEYS.include?(k) }.each { |k| - new_cx.set_(k,cx[k]) - } - ario.cx = new_cx - ario - end - def _add_cx(ario,keys) - new_cx = ario.cx - keys.each {|k| - 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_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 - _add_stream_iter_cx(ario) - end - def _add_stream_iter_cx(ario) - _add_cx(ario,CX_STREAM_ITER_KEYS) - new_cx = ario.cx - if stream_iter? - new_cx.set_('ss_args',cx['ss_args']) if cx.has_key?('ss_args') - new_cx.set_('ss_type',cx['ss_type']) if cx.has_key?('ss_type') - end - ario.cx = new_cx - ario - end - end - end -end