1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/pathname/pathname.c (path_ftype): Pathname#ftype translated

from pathname.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-08-08 04:21:26 +00:00
parent aac4f022e2
commit 739e022d00
3 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Sun Aug 8 13:20:57 2010 Tanaka Akira <akr@fsij.org>
* ext/pathname/pathname.c (path_ftype): Pathname#ftype translated
from pathname.rb.
Sun Aug 8 12:41:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (parser_tokadd_escape): no similar messages twice.

View file

@ -512,10 +512,6 @@ end
class Pathname # * File *
# See <tt>File.ftype</tt>. Returns "type" of file ("file", "directory",
# etc).
def ftype() File.ftype(@path) end
# See <tt>File.link</tt>. Creates a hard link.
def make_link(old) File.link(old, @path) end

View file

@ -314,6 +314,16 @@ path_fnmatch(int argc, VALUE *argv, VALUE self)
return rb_funcall(rb_cFile, rb_intern("fnmatch"), 3, pattern, str, flags);
}
/*
* See <tt>File.ftype</tt>. Returns "type" of file ("file", "directory",
* etc).
*/
static VALUE
path_ftype(VALUE self)
{
return rb_funcall(rb_cFile, rb_intern("ftype"), 1, get_strpath(self));
}
/*
* == Pathname
*
@ -523,4 +533,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "lchown", path_lchown, 2);
rb_define_method(rb_cPathname, "fnmatch", path_fnmatch, -1);
rb_define_method(rb_cPathname, "fnmatch?", path_fnmatch, -1);
rb_define_method(rb_cPathname, "ftype", path_ftype, 0);
}