class RIO::Rio
See also: RIO::Doc::SYNOPSIS
; RIO::Doc::INTRO
; RIO::Doc::HOWTO
.
Attributes
state[R]
Public Class Methods
new(*args)
click to toggle source
See RIO.rio
# File lib/rio.rb, line 62 def initialize(*args) if args[0].instance_of? RIO::Handle @state = args[0] else @state = Factory.instance.create_state(*args) end end
rio(*args) { |self| ... }
click to toggle source
See RIO.rio
# File lib/rio.rb, line 76 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
Public Instance Methods
<=>(other)
click to toggle source
Comparison for sorting; compare as strings.
# File lib/rio.rb, line 137 def <=>(other) self.to_str <=> other.to_str end
==(other)
click to toggle source
===(other)
click to toggle source
Equality (for case statements) same as Rio#==
# File lib/rio.rb, line 134 def ===(other) self == other end
=~(other)
click to toggle source
Match - invokes other.=~, passing the value returned by Rio#to_str
# File lib/rio.rb, line 146 def =~(other) other =~ self.to_str end
dup()
click to toggle source
# File lib/rio.rb, line 107 def dup #p callstr('dup',self) self.class.new(self.rl) end
hash()
click to toggle source
Rios are hashed based on their String representation
# File lib/rio.rb, line 140 def hash() self.to_str.hash end
initialize_copy(*args)
click to toggle source
Calls superclass method
# File lib/rio.rb, line 70 def initialize_copy(*args) super @state = Factory.instance.clone_state(@state) end
inspect()
click to toggle source
# File lib/rio.rb, line 157 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
length()
click to toggle source
Returns the length of the Rio's String representation
To get the size of the underlying file system object use RIO::IF::Test#size
# File lib/rio.rb, line 121 def length() target.length end
string()
click to toggle source
to_ary()
click to toggle source
Returns nil. Needed for 1.9.2+ problem with to_ary
and method_missing.
# File lib/rio.rb, line 113 def to_ary nil end
to_s()
click to toggle source
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"
# File lib/rio.rb, line 102 def to_s() target.to_s end