mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* object.c (rb_obj_methods): list singleton methods if recur
argument is false; list all methods otherwise. * numeric.c (num_step): double epsilon to make "1.1.step(1.5,0.1)" to work. * ext/gdbm/gdbm.c (fgdbm_values_at): new method to replace select(index..). * ext/sdbm/init.c (fsdbm_values_at): ditto. * ext/dbm/dbm.c (fdbm_values_at): ditto. * ext/dbm/dbm.c (DBM::VERSION): defined. * ext/gdbm/testgdbm.rb: replace select with values_at. * ext/sdbm/testsdbm.rb: ditto. * ext/dbm/testdbm.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6154ce97a7
commit
7752fb4205
13 changed files with 128 additions and 26 deletions
|
@ -242,6 +242,8 @@ fsdbm_select(argc, argv, obj)
|
|||
}
|
||||
}
|
||||
else {
|
||||
rb_warn("SDBM#select(index..) is deprecated; use SDBM#values_at");
|
||||
|
||||
for (i=0; i<argc; i++) {
|
||||
rb_ary_push(new, fsdbm_fetch(obj, argv[i], Qnil));
|
||||
}
|
||||
|
@ -250,6 +252,22 @@ fsdbm_select(argc, argv, obj)
|
|||
return new;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
fsdbm_values_at(argc, argv, obj)
|
||||
int argc;
|
||||
VALUE *argv;
|
||||
VALUE obj;
|
||||
{
|
||||
VALUE new = rb_ary_new2(argc);
|
||||
int i;
|
||||
|
||||
for (i=0; i<argc; i++) {
|
||||
rb_ary_push(new, fsdbm_fetch(obj, argv[i], Qnil));
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
fsdbm_delete(obj, keystr)
|
||||
VALUE obj, keystr;
|
||||
|
@ -728,6 +746,7 @@ Init_sdbm()
|
|||
rb_define_method(rb_cDBM, "indexes", fsdbm_indexes, -1);
|
||||
rb_define_method(rb_cDBM, "indices", fsdbm_indexes, -1);
|
||||
rb_define_method(rb_cDBM, "select", fsdbm_select, -1);
|
||||
rb_define_method(rb_cDBM, "values_at", fsdbm_values_at, -1);
|
||||
rb_define_method(rb_cDBM, "length", fsdbm_length, 0);
|
||||
rb_define_method(rb_cDBM, "size", fsdbm_length, 0);
|
||||
rb_define_method(rb_cDBM, "empty?", fsdbm_empty_p, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue