Module: RIO::IF::Test

Included in:
Rio
Defined in:
lib/rio/if/test.rb

Instance Method Summary collapse

Instance Method Details

#abs?Boolean

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

Returns:

  • (Boolean)


234
# File 'lib/rio/if/test.rb', line 234

def abs?() target.abs?()  end

#absolute?Boolean

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

Returns:

  • (Boolean)


244
# File 'lib/rio/if/test.rb', line 244

def absolute?() target.absolute?()  end

#atime(*args) ⇒ Object

Calls File#atime

Returns the last access time (a Time object) for the file system object referenced



134
# File 'lib/rio/if/test.rb', line 134

def atime(*args) target.atime(*args) end

#blockdev?Boolean

Calls FileTest#blockdev?

rio('afile').blockdev?     =>  true or false

Returns true if the named file is a block device.

Returns:

  • (Boolean)


31
# File 'lib/rio/if/test.rb', line 31

def blockdev?() target.blockdev?() end

#chardev?Boolean

Calls FileTest#chardev?

rio('afile').chardev?     =>  true or false

Returns true if the named file is a character device.

Returns:

  • (Boolean)


36
# File 'lib/rio/if/test.rb', line 36

def chardev?() target.chardev? end

#closed?Boolean

Calls IO#closed?

ario.closed?    => true or false

Returns true if ario is completely closed (for duplex streams, both reader and writer), false otherwise.

Returns:

  • (Boolean)


73
# File 'lib/rio/if/test.rb', line 73

def closed?() target.closed?()  end

#ctime(*args) ⇒ Object

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).



140
# File 'lib/rio/if/test.rb', line 140

def ctime(*args) target.ctime(*args) end

#dir?Boolean

Alias for #directory?

Returns:

  • (Boolean)


44
# File 'lib/rio/if/test.rb', line 44

def dir?() target.dir? end

#directory?Boolean

Calls FileTest#directory?

rio('afile').directory?     =>  true or false

Returns true if the named file is a directory, false otherwise.

Returns:

  • (Boolean)


41
# File 'lib/rio/if/test.rb', line 41

def directory?() target.directory? end

#executable?(*args) ⇒ Boolean

Calls File#executable?

Returns true if the file is executable by the effective user id of this process.

Returns:

  • (Boolean)


150
# File 'lib/rio/if/test.rb', line 150

def executable?(*args) target.executable?(*args) end

#executable_real?(*args) ⇒ Boolean

Calls File#executable_real?

Returns true if the file is executable by the real user id of this process.

Returns:

  • (Boolean)


155
# File 'lib/rio/if/test.rb', line 155

def executable_real?(*args) target.executable_real?(*args) end

#exist?Boolean

Calls FileTest#exist?

rio('afile').exist?()    =>  true or false

Returns true if the named file exists.

Returns:

  • (Boolean)


49
# File 'lib/rio/if/test.rb', line 49

def exist?() target.exist? end

#file?Boolean

Calls FileTest#file?

rio('afile').file?     => true or false

Returns true if the named file exists and is a regular file.

Returns:

  • (Boolean)


54
# File 'lib/rio/if/test.rb', line 54

def file?() target.file? end

#fnmatch?(*args) ⇒ Boolean

call-seq:

fnmatch?( pattern, [flags] ) => (true or false)

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

Returns:

  • (Boolean)


111
# File 'lib/rio/if/test.rb', line 111

def fnmatch?(*args) target.fnmatch?(*args) end

#ftype(*args) ⇒ Object

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�.



117
# File 'lib/rio/if/test.rb', line 117

def ftype(*args) target.ftype(*args) end

#grpowned?(*args) ⇒ Boolean

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.

Returns:

  • (Boolean)


197
# File 'lib/rio/if/test.rb', line 197

def grpowned?(*args) target.grpowned?(*args) end

#lstat(*args) ⇒ Object

Calls File#lstat



123
# File 'lib/rio/if/test.rb', line 123

def lstat(*args) target.lstat(*args) end

#mountpoint?Boolean

Calls Pathname#mountpoint?

Returns true if self points to a mountpoint.

Returns:

  • (Boolean)


249
# File 'lib/rio/if/test.rb', line 249

def mountpoint?() target.mountpoint?()  end

#mtime(*args) ⇒ Object

Calls File#mtime

Returns the modification time for Rio that reference file system objects



145
# File 'lib/rio/if/test.rb', line 145

def mtime(*args) target.mtime(*args) end

#open?Boolean

Returns true if a Rio is not #closed?

Returns:

  • (Boolean)


67
# File 'lib/rio/if/test.rb', line 67

def open?() target.open?() end

#owned?(*args) ⇒ Boolean

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.

Returns:

  • (Boolean)


190
# File 'lib/rio/if/test.rb', line 190

def owned?(*args) target.owned?(*args) end

#pipe?Boolean

Calls FileTest#pipe?

rio('afile').pipe?     =>  true or false

Returns true if the named file is a pipe.

Returns:

  • (Boolean)


128
# File 'lib/rio/if/test.rb', line 128

def pipe?() target.pipe?() end

#readable?(*args) ⇒ Boolean

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.

Returns:

  • (Boolean)


161
# File 'lib/rio/if/test.rb', line 161

def readable?(*args) target.readable?(*args) end

#readable_real?(*args) ⇒ Boolean

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.

Returns:

  • (Boolean)


167
# File 'lib/rio/if/test.rb', line 167

def readable_real?(*args) target.readable_real?(*args) end

#root?Boolean

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/...

Returns:

  • (Boolean)


259
# File 'lib/rio/if/test.rb', line 259

def root?() target.root?()  end

#setgid?(*args) ⇒ Boolean

Calls FileTest#setgid?

rio('afile').setgid?     =>  true or false

Returns true if the named file is a has the setgid bit set.

Returns:

  • (Boolean)


202
# File 'lib/rio/if/test.rb', line 202

def setgid?(*args) target.setgid?(*args) end

#setuid?(*args) ⇒ Boolean

Calls FileTest#setuid?

rio('afile').setuid?     =>  true or false

Returns true if the named file is a has the setuid bit set.

Returns:

  • (Boolean)


207
# File 'lib/rio/if/test.rb', line 207

def setuid?(*args) target.setuid?(*args) end

#size(*args) ⇒ Object

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



213
# File 'lib/rio/if/test.rb', line 213

def size(*args) target.size(*args) end

#size?(*args) ⇒ Boolean

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.

Returns:

  • (Boolean)


219
# File 'lib/rio/if/test.rb', line 219

def size?(*args) target.size?(*args) end

#socket?Boolean

Calls FileTest#socket?

rio('afile').socket?     =>  true or false

Returns true if the named file is a socket.

Returns:

  • (Boolean)


59
# File 'lib/rio/if/test.rb', line 59

def socket?() target.socket? end

#stat(*args) ⇒ Object

Calls File#stat



120
# File 'lib/rio/if/test.rb', line 120

def stat(*args) target.stat(*args) end

#sticky?(*args) ⇒ Boolean

Calls FileTest#sticky?

rio('afile').sticky?     =>  true or false

Returns true if the named file is a has the sticky bit set.

Returns:

  • (Boolean)


184
# File 'lib/rio/if/test.rb', line 184

def sticky?(*args) target.sticky?(*args) end

#symlink?Boolean

Calls FileTest#symlink?

rio('afile').symlink?     =>  true or false

Returns true if the named file is a symbolic link.

Returns:

  • (Boolean)


64
# File 'lib/rio/if/test.rb', line 64

def symlink?() target.symlink? end

#writable?(*args) ⇒ Boolean

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.

Returns:

  • (Boolean)


173
# File 'lib/rio/if/test.rb', line 173

def writable?(*args) target.writable?(*args) end

#writable_real?(*args) ⇒ Boolean

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.

Returns:

  • (Boolean)


179
# File 'lib/rio/if/test.rb', line 179

def writable_real?(*args) target.writable_real?(*args) end

#zero?(*args) ⇒ Boolean

Calls FileTest#zero?

rio('afile').zero?     => true or false

Returns true if the named file exists and has a zero size.

Returns:

  • (Boolean)


224
# File 'lib/rio/if/test.rb', line 224

def zero?(*args) target.zero?(*args) end