From b6595225c1a68f212eb2d11f35de7732b9114fd7 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 27 Aug 2010 23:19:30 +0000 Subject: [PATCH] * ext/pathname/pathname.c (path_blockdev_p): Pathname#blockdev? translated from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/pathname/lib/pathname.rb | 3 --- ext/pathname/pathname.c | 10 ++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5ce0b3128..56b57329f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Aug 28 08:11:05 2010 Tanaka Akira + + * ext/pathname/pathname.c (path_blockdev_p): Pathname#blockdev? + translated from pathname.rb. + Fri Aug 27 16:20:01 2010 URABE Shyouhei * string.c (rb_str_prepend): new method by Shota Fukumori (sora_h) diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index c9bf0c5fb8..f55ec1938a 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -486,9 +486,6 @@ end class Pathname # * FileTest * - # See FileTest.blockdev?. - def blockdev?() FileTest.blockdev?(@path) end - # See FileTest.chardev?. def chardev?() FileTest.chardev?(@path) end diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index f5ba6dc1ae..68ff682b2e 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -597,6 +597,15 @@ path_split(VALUE self) return rb_ary_new3(2, dirname, basename); } +/* + * See FileTest.blockdev?. + */ +static VALUE +path_blockdev_p(VALUE self) +{ + return rb_funcall(rb_mFileTest, rb_intern("blockdev?"), 1, get_strpath(self)); +} + /* * == Pathname * @@ -826,4 +835,5 @@ Init_pathname() rb_define_method(rb_cPathname, "extname", path_extname, 0); rb_define_method(rb_cPathname, "expand_path", path_expand_path, -1); rb_define_method(rb_cPathname, "split", path_split, 0); + rb_define_method(rb_cPathname, "blockdev?", path_blockdev_p, 0); }