|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyDir
public class RubyDir
.The Ruby built-in class Dir.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jruby.RubyObject |
---|
RubyObject.ObjectMethods |
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject |
---|
RubyBasicObject.BasicObjectMethods, RubyBasicObject.Finalizer, RubyBasicObject.VariableTableEntry |
Field Summary | |
---|---|
protected JRubyFile |
dir
|
Fields inherited from class org.jruby.RubyObject |
---|
OBJECT_ALLOCATOR |
Fields inherited from class org.jruby.RubyBasicObject |
---|
ALL_F, dataStruct, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, VARIABLE_TABLE_DEFAULT_CAPACITY, VARIABLE_TABLE_EMPTY_TABLE, VARIABLE_TABLE_LOAD_FACTOR, VARIABLE_TABLE_MAXIMUM_CAPACITY, variableTable, variableTableSize, variableTableThreshold |
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject |
---|
NULL_ARRAY |
Constructor Summary | |
---|---|
RubyDir(Ruby runtime,
RubyClass type)
|
Method Summary | |
---|---|
static IRubyObject |
aref(IRubyObject recv,
IRubyObject[] args)
|
static IRubyObject |
chdir(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
Changes the current directory to path |
static IRubyObject |
chroot(IRubyObject recv,
IRubyObject path)
Changes the root directory (only allowed by super user). |
IRubyObject |
close()
Closes the directory stream. |
static RubyClass |
createDirClass(Ruby runtime)
|
IRubyObject |
each(ThreadContext context,
Block block)
Executes the block once for each entry in the directory. |
IRubyObject |
each19(ThreadContext context,
Block block)
|
RubyArray |
entries()
|
static RubyArray |
entries(IRubyObject recv,
IRubyObject path)
Returns an array containing all of the filenames in the given directory. |
static IRubyObject |
foreach(ThreadContext context,
IRubyObject recv,
IRubyObject _path,
Block block)
Executes the block once for each file in the directory specified by path . |
static IRubyObject |
foreach19(ThreadContext context,
IRubyObject recv,
IRubyObject _path,
Block block)
|
protected static java.util.List<java.lang.String> |
getContents(java.io.File directory)
Returns the contents of the specified directory as an
ArrayList containing the names of the files as Java Strings. |
protected static java.util.List<RubyString> |
getContents(java.io.File directory,
Ruby runtime)
Returns the contents of the specified directory as an
ArrayList containing the names of the files as Ruby Strings. |
protected static JRubyFile |
getDir(Ruby runtime,
java.lang.String path,
boolean mustExist)
Returns a Java File object for the specified path. |
static RubyString |
getHomeDirectoryPath(ThreadContext context)
|
static IRubyObject |
getHomeDirectoryPath(ThreadContext context,
java.lang.String user)
Returns the home directory of the specified user on the
system. |
static RubyString |
getwd(IRubyObject recv)
Returns the current directory. |
static IRubyObject |
glob(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
Returns an array of filenames matching the specified wildcard pattern pat . |
IRubyObject |
initialize(IRubyObject _newPath,
Block unusedBlock)
Creates a new Dir . |
static IRubyObject |
mkdir(IRubyObject recv,
IRubyObject[] args)
Creates the directory specified by path . |
static IRubyObject |
open(ThreadContext context,
IRubyObject recv,
IRubyObject path,
Block block)
Returns a new directory object for path . |
IRubyObject |
path(ThreadContext context)
|
IRubyObject |
read()
Returns the next entry from this directory. |
IRubyObject |
rewind()
Moves position in this directory to the first entry. |
static IRubyObject |
rmdir(IRubyObject recv,
IRubyObject path)
Deletes the directory specified by path . |
IRubyObject |
seek(IRubyObject newPos)
Moves to a position d . |
IRubyObject |
set_pos(IRubyObject newPos)
|
RubyInteger |
tell()
Returns the current position in the directory. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected JRubyFile dir
Constructor Detail |
---|
public RubyDir(Ruby runtime, RubyClass type)
Method Detail |
---|
public static RubyClass createDirClass(Ruby runtime)
public IRubyObject initialize(IRubyObject _newPath, Block unusedBlock)
Dir
. This method takes a snapshot of the
contents of the directory at creation time, so changes to the contents
of the directory will not be reflected during the lifetime of the
Dir
object returned, so a new Dir
instance
must be created to reflect changes to the underlying file system.
public static IRubyObject aref(IRubyObject recv, IRubyObject[] args)
public static IRubyObject glob(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block)
pat
. If a block is given, the array is iterated internally
with each filename is passed to the block in turn. In this case, Nil is
returned.
public RubyArray entries()
public static RubyArray entries(IRubyObject recv, IRubyObject path)
public static IRubyObject chdir(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block)
path
public static IRubyObject chroot(IRubyObject recv, IRubyObject path)
public static IRubyObject rmdir(IRubyObject recv, IRubyObject path)
path
. The directory must
be empty.
public static IRubyObject foreach(ThreadContext context, IRubyObject recv, IRubyObject _path, Block block)
path
.
public static IRubyObject foreach19(ThreadContext context, IRubyObject recv, IRubyObject _path, Block block)
public static RubyString getwd(IRubyObject recv)
public static IRubyObject mkdir(IRubyObject recv, IRubyObject[] args)
path
. Note that the
mode
parameter is provided only to support existing Ruby
code, and is ignored.
public static IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject path, Block block)
path
. If a block is
provided, a new directory object is passed to the block, which closes the
directory object before terminating.
public IRubyObject close()
public IRubyObject each(ThreadContext context, Block block)
public IRubyObject each19(ThreadContext context, Block block)
public RubyInteger tell()
public IRubyObject seek(IRubyObject newPos)
d
. pos
must be a value
returned by tell
or 0.
public IRubyObject set_pos(IRubyObject newPos)
public IRubyObject path(ThreadContext context)
public IRubyObject read()
public IRubyObject rewind()
protected static JRubyFile getDir(Ruby runtime, java.lang.String path, boolean mustExist)
File
object for the specified path. If
path
is not a directory, throws IOError
.
path
- path for which to return the File
object.mustExist
- is true the directory must exist. If false it must not.
IOError
- if path
is not a directory.protected static java.util.List<java.lang.String> getContents(java.io.File directory)
directory
as an
ArrayList
containing the names of the files as Java Strings.
protected static java.util.List<RubyString> getContents(java.io.File directory, Ruby runtime)
directory
as an
ArrayList
containing the names of the files as Ruby Strings.
public static IRubyObject getHomeDirectoryPath(ThreadContext context, java.lang.String user)
user
on the
system. If the home directory of the specified user cannot be found,
an ArgumentError it thrown
.
public static RubyString getHomeDirectoryPath(ThreadContext context)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |