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_extname): Pathname#extname translated

from pathname.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-08-19 01:06:49 +00:00
parent bacb45c877
commit 078d19b29f
3 changed files with 16 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Thu Aug 19 10:06:08 2010 Tanaka Akira <akr@fsij.org>
* ext/pathname/pathname.c (path_extname): Pathname#extname translated
from pathname.rb.
Thu Aug 19 06:03:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_insnhelper.c (vm_push_frame): initialize block_iseq. a patch

View file

@ -512,9 +512,6 @@ end
class Pathname # * File *
# See <tt>File.extname</tt>. Returns the file's extension.
def extname() File.extname(@path) end
# See <tt>File.expand_path</tt>.
def expand_path(*args) self.class.new(File.expand_path(@path, *args)) end

View file

@ -449,6 +449,16 @@ path_dirname(VALUE self)
return rb_class_new_instance(1, &str, rb_obj_class(self));
}
/*
* See <tt>File.extname</tt>. Returns the file's extension.
*/
static VALUE
path_extname(VALUE self)
{
VALUE str = get_strpath(self);
return rb_funcall(rb_cFile, rb_intern("extname"), 1, str);
}
/*
* == Pathname
*
@ -670,4 +680,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "utime", path_utime, 2);
rb_define_method(rb_cPathname, "basename", path_basename, -1);
rb_define_method(rb_cPathname, "dirname", path_dirname, 0);
rb_define_method(rb_cPathname, "extname", path_extname, 0);
}