home PYTHONJAVA
 

Ruby Dir class and method

Dir is a catalog stream that speaks to the name of the record in the registry in the working framework. The Dir class likewise has catalog related activities, for example, trump card record name coordinating, changing the working index, etc.

class method

serial numbermethod & description
1Dir[pat]
Dir::glob( pat)

restores an exhibit containing the filenames that coordinate the predetermined special case design pat :
  • * - Matches any string containing an invalid string
  • ** - Recursively coordinate any string
  • ? - Match any single character
  • [...] - Match any of the encased characters
  • {a,b...} - Match any of the strings
Dir["foo.*"] # matches "foo.c", "foo.rb", etc.
Dir["foo.?"] # matches "foo.c", "foo.h", and so on.
2Dir::chdir( path)
Change the present registry.
3Dir::chroot( path)
Change the root registry (superusers as it were). Not accessible on all stages.
4Dir::delete( path)
Delete the registry indicated by way. The registry must be unfilled.
5Dir::entries( path)
restores an exhibit containing the filenames in the registry way.
6Dir::foreach( way) {| f| ...}
Execute each document in the catalog determined by way One square.
7Dir::getwd
Dir::pwd

restores the present index.
8Dir::mkdir( path[, mode=0777])
Create the index determined by way. Consent mode can be changed by the estimation of File::umask and will be disregarded on Win32 stages.
9Dir::new( path)
Dir::open( path)
Dir::open( way) {| dir| ...}

restores another index object for way . In the event that open gives a square, the new registry object is passed to the square, and the square shuts the index object before ending.
10Dir::pwd
See Dir::getwd.
11Dir::rmdir( path)
Dir::unlink( path)
Dir::delete( path)

Delete the index indicated by way. The index must be vacant.

Instance method

Assume that d is an occurrence of the Dir class:

serial numbermethod & description
1d.close
Close the index stream.
2d.each {| f| ...}
Executes a square for every section in d.
3d.pos
D.tell
restores the present position in d.
4d.pos=offset
Set the area in the registry stream.
5d.pos= pos
D.seek(pos)

moves to an area in d. Pos must be an esteem returned by d.pos or 0.
6d.read
Returns the following passage for d.
7d.rewind
Move the situation in d to the main section.
8d.seek(po s)
See d.pos=pos.
9d.tell
See d.pos.





welookups is optimized for learning.© welookups. 2018 - 2019 All Right Reserved and you agree to have read and accepted our term and condition.