Class: RIO::File::Existing

Inherits:
Base show all
Includes:
Enumerable, Ops::File::Existing
Defined in:
lib/rio/file.rb

Constant Summary

Constants inherited from State::Base

State::Base::KIOSYMS

Instance Attribute Summary

Attributes inherited from State::Base

#data, #try_state

Instance Method Summary collapse

Methods included from Ops::File::Existing

#clear, #delete, #empty?, #selective?, #touch, #truncate

Methods included from Ext::Mp3Info

#album, #artist, #mp3info, #mp3length, #time, #title, #vbr, #year

Methods included from RIO::Fwd

#fwd, #fwd_reader, #fwd_readers, #fwd_writer, #fwd_writers

Methods included from Piper::Cp::Input

#has_output_dest?, #last_rio, #|

Methods included from Cp::File::Input

#>, #>>, #copy_as_file?, #spcp

Methods included from Cp::Util::InOut

#cpclose, #cpclose0

Methods included from Cp::File::Output

#<, #<<

Methods included from Ops::FileOrDir::Existing

#basename=, #chmod, #chown, #dirname=, #empty?, #extname=, #filename=, #mountpoint?, #must_exist, #realpath, #rename, #rename!, #ss_type?

Methods inherited from Base

#fstream, #when_missing

Methods included from Ops::Path::ExistOrNot

#symlink

Methods included from Ops::Path::URI

#abs, #absolute?, #base, #merge, #rel, #route_from, #route_to, #setbase

Methods included from Ops::Path::Create

#/, #cleanpath, #cwd, #getwd, #join, #join!, #rootpath

Methods included from Ops::Path::Query

#+, #basename, #dirname, #expand_path, #extname, #filename, #gsub, #normalize, #splitpath, #sub

Methods included from Ops::Path::Status

#atime, #ctime, #executable?, #executable_real?, #fnmatch, #fnmatch?, #ftype, #grpowned?, #mtime, #owned?, #readable?, #readable_real?, #root?, #setgid?, #setuid?, #size, #size?, #stat, #sticky?, #writable?, #writable_real?, #zero?

Methods included from Ops::Path::Test

#blockdev?, #chardev?, #closed?, #directory?, #exist?, #file?, #open?, #pipe?, #socket?, #symlink?

Methods inherited from State::Base

#==, #===, #=~, #base_state, #became, #become, #callstr, #clone_rio, default_cx, #ensure_cmd_rio, #ensure_rio, #error, #fs, #gofigure, #hash, #initialize, #initialize_copy, #method_missing, #method_missing_trace_str, new_other, #new_rio, #new_rio_cx, #reset, #retryreset, #softreset, #stream?, #to_a, #to_ary, #to_rl, #to_uri, #to_url, #uri, #when_missing

Methods included from ZipFile::Cx

#zipfile

Methods included from Symantics

#rtn_new, #rtn_reset, #rtn_rio, #rtn_self, #rtn_val

Methods included from Ext::YAML::Cx

#document, #documents, #object, #objects, #skipdocuments, #skipobjects, #yaml, #yaml?, #yamldoc

Methods included from Ext::SplitLines::Cx

#columns, #columns?, #skipcolumns, #splitlines, #splitlines?

Methods included from Ext::CSV::Cx

#columns, #columns?, #csv, #csv?, #fields, #fields?, #headers, #headers?, #skipcolumns, #skipfields

Methods included from Cx::Methods

#+@, #_arg_skip, #_noarg_skip, #a, #a!, #all, #all?, #binmode, #binmode?, #bytes, #bytes_, #closeoncopy, #closeoncopy?, #closeoneof, #closeoneof?, #copying, #copying?, #copying_done, #copying_from, #copying_from?, #copying_from_done, #copying_to, #copying_to?, #copying_to_done, #dir_iter?, #dirs, #enc, #enc?, #enc_opts?, #entries, #ext, #ext?, #ext_enc?, #files, #gzip, #gzip?, #inputmode?, #int_enc?, #line, #line_, #lines, #lines_, make_filter_methods, #mode, #mode?, #noall, #noautoclose, #nocloseoncopy, #nocloseoneof, #noext, #norecurse, #nostreamenum, #nostreamenum?, #nosync, #outputmode?, #r, #r!, #record, #record_, #records, #records_, #recurse, #row, #row_, #rows, #rows_, #skip, #skipdirs, #skipentries, #skipfiles, #skiplines, #skipping?, #skiprecords, #skiprecords_, #skiprows, #split, #stream_iter?, #sync, #sync?, #w, #w!

Constructor Details

This class inherits a constructor from RIO::State::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RIO::State::Base

Instance Method Details

#[](*args) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/rio/file.rb', line 63

def [](*args)
  #p "#{callstr('[]',*args)} ss_type=#{ss_type?}"
  return self.yamldoc[*args] if cx['yamldoc']
  if _using_files_with_a_file
    unless args.empty?
      ss_args = cx['ss_args'] = args
      return self.files(*ss_args).to_a
    else
      return to_a()
    end
  else
    fstream[*args]
  end
  
end

#check?Boolean

Returns:

  • (Boolean)


57
# File 'lib/rio/file.rb', line 57

def check?() self.file? end

#each(*args, &block) ⇒ Object



78
79
80
81
82
83
84
85
86
87
# File 'lib/rio/file.rb', line 78

def each(*args,&block)
  #p "#{callstr('each',*args)} ss_type=#{ss_type?}"
  if _using_files_with_a_file
    handle_skipped()
    sel = Match::Entry::Selector.new(cx['entry_sel'])
    yield new_rio_cx(self) if sel.match?(self)
  else
    fstream.each(*args,&block)
  end
end

#handle_skippedObject



58
59
60
61
62
# File 'lib/rio/file.rb', line 58

def handle_skipped
  return self unless cx.has_key?('skip_args')
  args = cx['skip_args'] || []
  self.skipentries(*args)
end