7363.patch

Zachary Scott, 11/19/2012 07:12 AM

Download (1.67 KB)

View differences:

ext/pathname/pathname.c
858 858
}
859 859

  
860 860
/*
861
 * Returns a new instance of Pathname initialized with string
862
 */
863
static VALUE
864
path_s_square_brackets(VALUE self, VALUE string)
865
{
866
    return rb_class_new_instance(1, &string, rb_cPathname);
867
}
868

  
869
/*
861 870
 * Return the entries (files and subdirectories) in the directory, each as a
862 871
 * Pathname object.
863 872
 *
......
969 978
static VALUE
970 979
path_f_pathname(VALUE self, VALUE str)
971 980
{
981
    rb_warn("Kernel#Pathname is deprecated; use Pathname.[] instead");
972 982
    return rb_class_new_instance(1, &str, rb_cPathname);
973 983
}
974 984

  
......
1225 1235
    rb_define_method(rb_cPathname, "world_writable?", path_world_writable_p, 0);
1226 1236
    rb_define_method(rb_cPathname, "writable_real?", path_writable_real_p, 0);
1227 1237
    rb_define_method(rb_cPathname, "zero?", path_zero_p, 0);
1238
    rb_define_singleton_method(rb_cPathname, "[]", path_s_square_brackets, 1);
1228 1239
    rb_define_singleton_method(rb_cPathname, "glob", path_s_glob, -1);
1229 1240
    rb_define_singleton_method(rb_cPathname, "getwd", path_s_getwd, 0);
1230 1241
    rb_define_singleton_method(rb_cPathname, "pwd", path_s_getwd, 0);
1231
-