Class: RIO::Rio
- Includes:
- Enumerable, IF::CSV, IF::Ext, IF::File, IF::FileOrDir, IF::Grande, IF::GrandeEntry, IF::GrandeStream, IF::String, IF::YAML, Local
- Defined in:
- lib/rio.rb,
lib/rio.rb,
lib/rio/if.rb,
lib/rio/if.rb,
lib/rio/def.rb,
lib/rio/kernel.rb,
lib/rio/if/file.rb,
lib/rio/if/temp.rb,
lib/rio/if/basic.rb,
lib/rio/construct.rb,
lib/rio/if/grande.rb,
lib/rio/if/string.rb,
lib/rio/if/string.rb,
lib/rio/if/internal.rb,
lib/rio/if/fileordir.rb,
lib/rio/if/grande_entry.rb,
lib/rio/if/grande_stream.rb
Overview
See also: RIO::Doc::SYNOPSIS; RIO::Doc::INTRO; RIO::Doc::HOWTO.
Constant Summary collapse
- USE_IF =
:nodoc:
true
Constants included from Local
Local::ROOT_DIR, Local::SEPARATOR
Constants inherited from Base
Class Method Summary collapse
-
.rio(*args, &block) ⇒ Object
See RIO.rio.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Equality - calls to_s on other and compares its return value with the value returned by Rio#to_s.
-
#===(other) ⇒ Object
Equality (for case statements) same as Rio#==.
-
#=~(other) ⇒ Object
Match - invokes other.=~, passing the value returned by Rio#to_str.
-
#copyclose ⇒ Object
This is an internal function and is not needed in client code.
-
#cpclose(*args, &block) ⇒ Object
This is an internal function and is not needed in client code.
-
#cx ⇒ Object
This is an internal function and is not needed in client code.
-
#cx=(arg) ⇒ Object
This is an internal function and is not needed in client code.
- #dup ⇒ Object
-
#each_record(*args, &block) ⇒ Object
This is an internal function and is not needed in client code.
-
#each_row(*args, &block) ⇒ Object
This is an internal function and is not needed in client code.
-
#eql?(other) ⇒ Boolean
Returns true if their String representations are eql?.
-
#getwd(*args) ⇒ Object
This is an internal function and is not needed in client code.
-
#hash ⇒ Object
Rios are hashed based on their String representation.
-
#initialize(*args) ⇒ Rio
constructor
See RIO.rio.
- #initialize_copy(*args) ⇒ Object
-
#inputmode? ⇒ Boolean
This is an internal function and is not needed in client code.
- #inspect ⇒ Object
-
#iostate(sym) ⇒ Object
This is an internal function and is not needed in client code.
-
#length ⇒ Object
Returns the length of the Rio’s String representation.
-
#method_missing(sym, *args, &block) ⇒ Object
:nodoc:.
-
#nostreamenum ⇒ Object
This is an internal function and is not needed in client code.
-
#outputmode? ⇒ Boolean
This is an internal function and is not needed in client code.
-
#reset ⇒ Object
This is an internal function and should not normally be needed in client code.
-
#rl ⇒ Object
This is an internal function and is not needed in client code.
-
#stream_iter? ⇒ Boolean
This is an internal function and is not needed in client code.
-
#string ⇒ Object
Returns the String associated with a Rio which references a StringIO object.
-
#to_rl ⇒ Object
This is an internal function and is not needed in client code.
-
#to_s ⇒ Object
(also: #to_str)
Returns the string representation of a Rio that is used by Ruby’s libraries.
Methods included from IF::GrandeStream
#+@, #a, #a!, #bytes, #chomp, #chomp?, #closeoncopy, #closeoncopy?, #closeoneof, #closeoneof?, #contents, #getline, #getrec, #getrow, #gzip, #gzip?, #line, #lines, #noautoclose, #nocloseoncopy, #nocloseoneof, #putrec, #r, #r!, #record, #records, #row, #rows, #skiplines, #skiprecords, #skiprows, #splitlines, #strip, #strip?, #w, #w!
Methods included from IF::GrandeEntry
#all, #all?, #dirs, #entries, #files, #norecurse, #recurse, #skipdirs, #skipentries, #skipfiles
Methods included from IF::FileOrDir
#open, #pos, #pos=, #read, #readlink, #rename, #rename!, #reopen, #rewind, #seek, #symlink, #tell
Methods included from IF::String
Methods included from IF::File
#clear, #rm, #touch, #truncate
Methods included from IF::YAML
#documents, #dump, #getobj, #load, #objects, #putobj, #putobj!, #skipdocuments, #skipobjects, #yaml, #yaml?
Methods included from IF::CSV
Methods included from IF::Ext
Methods included from IF::Grande
#<, #<<, #>, #>>, #[], #append_from, #append_to, #copy_from, #copy_to, #delete, #delete!, #each, #empty?, #get, #skip, #split, #to_a, #|
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
:nodoc:
109 110 111 112 113 114 115 116 |
# File 'lib/rio.rb', line 109 def method_missing(sym,*args,&block) #:nodoc: #p callstr('method_missing',sym,*args) result = target.__send__(sym,*args,&block) return result unless result.kind_of? State::Base and result.equal? target self end |
Class Method Details
.rio(*args, &block) ⇒ Object
See RIO.rio
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rio.rb', line 75 def self.rio(*args,&block) # :yields: self ario = new(*args) if block_given? old_closeoncopy = ario.closeoncopy? begin yield ario.nocloseoncopy ensure ario.reset.closeoncopy(old_closeoncopy) end end ario end |
Instance Method Details
#==(other) ⇒ Object
Equality - calls to_s on other and compares its return value with the value returned by Rio#to_s
49 |
# File 'lib/rio/if/basic.rb', line 49 def ==(other) target == other end |
#===(other) ⇒ Object
Equality (for case statements) same as Rio#==
52 |
# File 'lib/rio/if/basic.rb', line 52 def ===(other) target === other end |
#=~(other) ⇒ Object
Match - invokes other.=~, passing the value returned by Rio#to_str
61 |
# File 'lib/rio/if/basic.rb', line 61 def =~(other) target =~ other end |
#copyclose ⇒ Object
This is an internal function and is not needed in client code.
73 74 75 |
# File 'lib/rio/if/internal.rb', line 73 def copyclose() # :nodoc: target.copyclose end |
#cpclose(*args, &block) ⇒ Object
This is an internal function and is not needed in client code.
83 84 85 |
# File 'lib/rio/if/internal.rb', line 83 def cpclose(*args,&block) # :nodoc: target.cpclose(*args,&block) end |
#cx ⇒ Object
This is an internal function and is not needed in client code. It returns the internal ‘Rio Context’ object.
63 64 65 |
# File 'lib/rio/if/internal.rb', line 63 def cx() # :nodoc: target.cx() end |
#cx=(arg) ⇒ Object
This is an internal function and is not needed in client code.
68 69 70 |
# File 'lib/rio/if/internal.rb', line 68 def cx=(arg) # :nodoc: target.cx = arg end |
#dup ⇒ Object
104 105 106 107 |
# File 'lib/rio.rb', line 104 def dup #p callstr('dup',self) self.class.new(self.to_rl) end |
#each_record(*args, &block) ⇒ Object
This is an internal function and is not needed in client code.
88 89 90 |
# File 'lib/rio/if/internal.rb', line 88 def each_record(*args,&block) # :nodoc: target.each_record(*args,&block) end |
#each_row(*args, &block) ⇒ Object
This is an internal function and is not needed in client code.
93 94 95 |
# File 'lib/rio/if/internal.rb', line 93 def each_row(*args,&block) # :nodoc: target.each_row(*args,&block) end |
#eql?(other) ⇒ Boolean
Returns true if their String representations are eql?
58 |
# File 'lib/rio/if/basic.rb', line 58 def eql?(other) target.eql?(other) end |
#getwd(*args) ⇒ Object
This is an internal function and is not needed in client code.
113 114 115 |
# File 'lib/rio/if/internal.rb', line 113 def getwd(*args) # :nodoc: target.getwd(*args) end |
#hash ⇒ Object
Rios are hashed based on their String representation
55 |
# File 'lib/rio/if/basic.rb', line 55 def hash() target.hash end |
#initialize_copy(*args) ⇒ Object
68 69 70 71 72 |
# File 'lib/rio.rb', line 68 def initialize_copy(*args) #p callstr("initialize_copy",args[0].inspect) super @state = Factory.instance.clone_state(@state) end |
#inputmode? ⇒ Boolean
This is an internal function and is not needed in client code.
103 104 105 |
# File 'lib/rio/if/internal.rb', line 103 def inputmode?() # :nodoc: target.inputmode? end |
#inspect ⇒ Object
118 119 120 121 122 |
# File 'lib/rio.rb', line 118 def inspect() cl = self.class.to_s[5..-1] st = state.target.class.to_s[5..-1] sprintf('#<%s:0x%x:"%s" (%s)>',cl,self.object_id,self.to_url,st) end |
#iostate(sym) ⇒ Object
This is an internal function and is not needed in client code.
108 109 110 |
# File 'lib/rio/if/internal.rb', line 108 def iostate(sym) # :nodoc: target.iostate(sym) end |
#length ⇒ Object
Returns the length of the Rio’s String representation
To get the size of the underlying file system object use RIO::IF::Test#size
45 |
# File 'lib/rio/if/basic.rb', line 45 def length() target.length end |
#nostreamenum ⇒ Object
This is an internal function and is not needed in client code.
78 79 80 |
# File 'lib/rio/if/internal.rb', line 78 def () # :nodoc: target. end |
#outputmode? ⇒ Boolean
This is an internal function and is not needed in client code.
98 99 100 |
# File 'lib/rio/if/internal.rb', line 98 def outputmode?() # :nodoc: target.outputmode? end |
#reset ⇒ Object
This is an internal function and should not normally be needed in client code. It closes a Rio and returns it to its ‘reset’ state.
45 46 47 |
# File 'lib/rio/if/internal.rb', line 45 def reset() # :nodoc: target.reset() end |
#rl ⇒ Object
This is an internal function and is not needed in client code. It returns the internal ‘Rio Resource Locator’ object.
51 52 53 |
# File 'lib/rio/if/internal.rb', line 51 def rl() # :nodoc: target.rl() end |
#stream_iter? ⇒ Boolean
This is an internal function and is not needed in client code.
118 119 120 |
# File 'lib/rio/if/internal.rb', line 118 def stream_iter?() # :nodoc: target.stream_iter? end |
#string ⇒ Object
Returns the String associated with a Rio which references a StringIO object. For any other type of Rio, is undefined.
41 |
# File 'lib/rio/if/string.rb', line 41 def string() target.string end |
#to_rl ⇒ Object
This is an internal function and is not needed in client code. It returns the internal ‘Rio Resource Locator’ object.
57 58 59 |
# File 'lib/rio/if/internal.rb', line 57 def to_rl() # :nodoc: target.to_rl() end |
#to_s ⇒ Object Also known as: to_str
Returns the string representation of a Rio that is used by Ruby’s libraries. For Rios that exist on the file system this is Rio#fspath. For FTP and HTTP Rios, this is the URL.
rio('/a/b/c').to_s ==> "/a/b/c"
rio('b/c').to_s ==> "b/c"
rio('C:/b/c').to_s ==> "C:/b/c"
rio('//ahost/a/b').to_s ==> "//ahost/a/b"
rio('file://ahost/a/b').to_s ==> "//ahost/a/b"
rio('file:///a/b').to_s ==> "/a/b"
rio('file://localhost/a/b').to_s ==> "/a/b"
rio('http://ahost/index.html').to_s ==> "http://ahost/index.html"
101 |
# File 'lib/rio.rb', line 101 def to_s() target.to_s end |