module RIO::IF::Test
Public Instance Methods
Returns true if the rio represents an absolute path or URI. Alias for #absolute?
rio('/tmp').abs? # >> true rio('.ssh').abs? # >> false rio('file:///tmp').abs? # >> true rio('http://www.ruby-doc.org/').abs? # >> true
# File lib/rio/if/test.rb, line 233 def abs?() target.abs?() end
Returns true if the Rio
represents and absolute path or URI. Calls URI#absolute?
rio('/tmp').absolute? # >> true rio('.ssh').absolute? # >> false rio('file:///tmp').absolute? # >> true rio('http://www.ruby-doc.org/').absolute? # >> true
# File lib/rio/if/test.rb, line 243 def absolute?() target.absolute?() end
Calls File#atime
Returns the last access time (a Time object) for the file system object referenced
# File lib/rio/if/test.rb, line 133 def atime(*args) target.atime(*args) end
Calls FileTest#blockdev?
rio('afile').blockdev? => true or false
Returns true
if the named file is a block device.
# File lib/rio/if/test.rb, line 30 def blockdev?() target.blockdev?() end
Calls FileTest#chardev?
rio('afile').chardev? => true or false
Returns true
if the named file is a character device.
# File lib/rio/if/test.rb, line 35 def chardev?() target.chardev? end
Calls IO#closed?
ario.closed? => true or false
Returns true
if ario is completely closed (for duplex streams, both reader and writer), false
otherwise.
# File lib/rio/if/test.rb, line 72 def closed?() target.closed?() end
Calls File#ctime
Returns the change time for Rios that reference file system object (that is, the time directory information about the file was changed, not the file itself).
# File lib/rio/if/test.rb, line 139 def ctime(*args) target.ctime(*args) end
Alias for directory?
# File lib/rio/if/test.rb, line 43 def dir?() target.dir? end
Calls FileTest#directory?
rio('afile').directory? => true or false
Returns true
if the named file is a directory, false
otherwise.
# File lib/rio/if/test.rb, line 40 def directory?() target.directory? end
Calls File#executable?
Returns true if the file is executable by the effective user id of this process.
# File lib/rio/if/test.rb, line 149 def executable?(*args) target.executable?(*args) end
Calls File#executable_real?
Returns true if the file is executable by the real user id of this process.
# File lib/rio/if/test.rb, line 154 def executable_real?(*args) target.executable_real?(*args) end
Calls FileTest#exist?
rio('afile').exist?() => true or false
Returns true
if the named file exists.
# File lib/rio/if/test.rb, line 48 def exist?() target.exist? end
Calls FileTest#file?
rio('afile').file? => true or false
Returns true
if the named file exists and is a regular file.
# File lib/rio/if/test.rb, line 53 def file?() target.file? end
Calls File#fnmatch?
Returns true if #path matches pattern. The pattern is not a regular expression; instead it follows rules similar to shell filename globbing. It may contain the following metacharacters:
flags is a bitwise OR of the FNM_xxx
parameters. The same glob pattern and flags are used by Dir::glob
.
rio('cat').fnmatch?('cat') #=> true rio('category').fnmatch?('cat') #=> false rio('cats').fnmatch?('c{at,ub}s') #=> false rio('cubs').fnmatch?('c{at,ub}s') #=> false rio('cat').fnmatch?('c{at,ub}s') #=> false rio('cat').fnmatch?('c?t') #=> true rio('cat').fnmatch?('c\?t') #=> false rio('cat').fnmatch?('c??t') #=> false rio('cats').fnmatch?('c*') #=> true rio('cat').fnmatch?('c*t') #=> true rio('cat').fnmatch?('c\at') #=> true rio('cat').fnmatch?('c\at',File::FNM_NOESCAPE) #=> false rio('a/b').fnmatch?('a?b') #=> true rio('a/b').fnmatch?('a?b',File::FNM_PATHNAME) #=> false rio('.profile').fnmatch?('*') #=> false rio('.profile').fnmatch?('*',File::FNM_DOTMATCH) #=> true rio('dave/.profile').fnmatch?('*') #=> true rio('dave/.profile').fnmatch?('*',File::FNM_DOTMATCH) #=> true rio('dave/.profile').fnmatch?('*',File::FNM_PATHNAME) #=> false
# File lib/rio/if/test.rb, line 110 def fnmatch?(*args) target.fnmatch?(*args) end
Calls File#ftype
Identifies the type of the named file; the return string is one of 'file�, 'directory�, 'characterSpecial�, 'blockSpecial�, 'fifo�, 'link�, 'socket�, or 'unknown�.
# File lib/rio/if/test.rb, line 116 def ftype(*args) target.ftype(*args) end
Calls FileTest#grpowned?
rio('afile').grpowned? => true or false
Returns true
if the named file exists and the effective group id of the calling process is the owner of the file. Returns false
on Windows.
# File lib/rio/if/test.rb, line 196 def grpowned?(*args) target.grpowned?(*args) end
Calls File#lstat
# File lib/rio/if/test.rb, line 122 def lstat(*args) target.lstat(*args) end
Calls Pathname#mountpoint?
Returns true
if self
points to a mountpoint.
# File lib/rio/if/test.rb, line 248 def mountpoint?() target.mountpoint?() end
Calls File#mtime
Returns the modification time for Rio
that reference file system objects
# File lib/rio/if/test.rb, line 144 def mtime(*args) target.mtime(*args) end
Calls FileTest#owned?
rio('afile').owned? => true or false
Returns true
if the named file exists and the effective used id of the calling process is the owner of the file.
# File lib/rio/if/test.rb, line 189 def owned?(*args) target.owned?(*args) end
Calls FileTest#pipe?
rio('afile').pipe? => true or false
Returns true
if the named file is a pipe.
# File lib/rio/if/test.rb, line 127 def pipe?() target.pipe?() end
Calls FileTest#readable?
rio('afile').readable? => true or false
Returns true
if the named file is readable by the effective user
id of this process.
# File lib/rio/if/test.rb, line 160 def readable?(*args) target.readable?(*args) end
Calls FileTest#readable_real?
rio('afile').readable_real? => true or false
Returns true
if the named file is readable by the real user id of this process.
# File lib/rio/if/test.rb, line 166 def readable_real?(*args) target.readable_real?(*args) end
Calls Pathname#root?
root?
is a predicate for root directories. I.e. it returns true
if the pathname consists of consecutive slashes.
It doesn't access the actual filesystem. So it may return false
for some pathnames which points to roots such as /usr/..
.
# File lib/rio/if/test.rb, line 258 def root?() target.root?() end
Calls FileTest#setgid?
rio('afile').setgid? => true or false
Returns true
if the named file is a has the setgid bit set.
# File lib/rio/if/test.rb, line 201 def setgid?(*args) target.setgid?(*args) end
Calls FileTest#setuid?
rio('afile').setuid? => true or false
Returns true
if the named file is a has the setuid bit set.
# File lib/rio/if/test.rb, line 206 def setuid?(*args) target.setuid?(*args) end
Calls FileTest#size
rio('afile').size => integer
Returns the size of afile. To get the length of the Rio's string representation use Rio#length
# File lib/rio/if/test.rb, line 212 def size(*args) target.size(*args) end
Calls FileTest#size?
rio('afile').size? => integer or nil
Returns nil
if afile doesn't exist or has zero size, the size of the file otherwise.
# File lib/rio/if/test.rb, line 218 def size?(*args) target.size?(*args) end
Calls FileTest#socket?
rio('afile').socket? => true or false
Returns true
if the named file is a socket.
# File lib/rio/if/test.rb, line 58 def socket?() target.socket? end
Calls File#stat
# File lib/rio/if/test.rb, line 119 def stat(*args) target.stat(*args) end
Calls FileTest#sticky?
rio('afile').sticky? => true or false
Returns true
if the named file is a has the sticky bit set.
# File lib/rio/if/test.rb, line 183 def sticky?(*args) target.sticky?(*args) end
Calls FileTest#symlink?
rio('afile').symlink? => true or false
Returns true
if the named file is a symbolic link.
# File lib/rio/if/test.rb, line 63 def symlink?() target.symlink? end
Calls FileTest#writable?
rio('afile').writable? => true or false
Returns true
if the named file is writable by the effective user id of this process.
# File lib/rio/if/test.rb, line 172 def writable?(*args) target.writable?(*args) end
Calls FileTest#writable_real?
rio('afile').writable_real? => true or false
Returns true
if the named file is writable by the real user id of this process.
# File lib/rio/if/test.rb, line 178 def writable_real?(*args) target.writable_real?(*args) end
Calls FileTest#zero?
rio('afile').zero? => true or false
Returns true
if the named file exists and has a zero size.
# File lib/rio/if/test.rb, line 223 def zero?(*args) target.zero?(*args) end