mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* object.c (rb_obj_tap): a new method. [ruby-talk:224013]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5dd8f6e20c
commit
0d9c33d14b
2 changed files with 22 additions and 0 deletions
|
@ -8,6 +8,10 @@ Wed Nov 22 16:00:49 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
|||
* ext/tk/tkutil/extconf.rb: able to be called manually
|
||||
[ruby-talk:225950].
|
||||
|
||||
Sat Nov 18 23:39:20 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* object.c (rb_obj_tap): a new method. [ruby-talk:224013]
|
||||
|
||||
Wed Nov 15 23:22:54 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (test_grpowned, rb_stat_grpowned): should honor
|
||||
|
|
18
object.c
18
object.c
|
@ -409,6 +409,23 @@ rb_obj_is_kind_of(VALUE obj, VALUE c)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* obj.tap{|x|...} => obj
|
||||
*
|
||||
* Returns the receiver after executing the block given. Its main
|
||||
* purpose is to be inseted in the method chain.
|
||||
*
|
||||
*/
|
||||
|
||||
VALUE
|
||||
rb_obj_tap(VALUE obj)
|
||||
{
|
||||
rb_yield(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Document-method: inherited
|
||||
*
|
||||
|
@ -2326,6 +2343,7 @@ Init_Object(void)
|
|||
rb_define_method(rb_mKernel, "instance_of?", rb_obj_is_instance_of, 1);
|
||||
rb_define_method(rb_mKernel, "kind_of?", rb_obj_is_kind_of, 1);
|
||||
rb_define_method(rb_mKernel, "is_a?", rb_obj_is_kind_of, 1);
|
||||
rb_define_method(rb_mKernel, "tap", rb_obj_tap, 0);
|
||||
|
||||
rb_define_private_method(rb_mKernel, "singleton_method_added", rb_obj_dummy, 1);
|
||||
rb_define_private_method(rb_mKernel, "singleton_method_removed", rb_obj_dummy, 1);
|
||||
|
|
Loading…
Reference in a new issue