mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/pathname/pathname.c (path_read): Pathname#read translated from
pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f2ff3eb6ec
commit
f21230b491
3 changed files with 26 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Aug 24 22:07:28 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/pathname/pathname.c (path_read): Pathname#read translated from
|
||||
pathname.rb.
|
||||
|
||||
Tue Aug 24 10:11:04 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in: read API version from include/ruby/version.h.
|
||||
|
|
|
@ -484,9 +484,6 @@ class Pathname
|
|||
end
|
||||
|
||||
class Pathname # * IO *
|
||||
# See <tt>IO.read</tt>. Returns all data from the file, or the first +N+ bytes
|
||||
# if specified.
|
||||
def read(*args) IO.read(@path, *args) end
|
||||
|
||||
# See <tt>IO.binread</tt>. Returns all the bytes from the file, or the first +N+
|
||||
# if specified.
|
||||
|
|
|
@ -261,6 +261,26 @@ path_each_line(int argc, VALUE *argv, VALUE self)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* pathname.read([length [, offset]]) -> string
|
||||
* pathname.read([length [, offset]], open_args) -> string
|
||||
*
|
||||
* See <tt>IO.read</tt>. Returns all data from the file, or the first +N+ bytes
|
||||
* if specified.
|
||||
*
|
||||
*/
|
||||
static VALUE
|
||||
path_read(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE args[4];
|
||||
int n;
|
||||
|
||||
args[0] = get_strpath(self);
|
||||
n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]);
|
||||
return rb_funcall2(rb_cIO, rb_intern("read"), 1+n, args);
|
||||
}
|
||||
|
||||
/*
|
||||
* See <tt>File.atime</tt>. Returns last access time.
|
||||
*/
|
||||
|
@ -721,6 +741,7 @@ Init_pathname()
|
|||
rb_define_method(rb_cPathname, "realpath", path_realpath, -1);
|
||||
rb_define_method(rb_cPathname, "realdirpath", path_realdirpath, -1);
|
||||
rb_define_method(rb_cPathname, "each_line", path_each_line, -1);
|
||||
rb_define_method(rb_cPathname, "read", path_read, -1);
|
||||
rb_define_method(rb_cPathname, "atime", path_atime, 0);
|
||||
rb_define_method(rb_cPathname, "ctime", path_ctime, 0);
|
||||
rb_define_method(rb_cPathname, "mtime", path_mtime, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue