Skip to content

Commit

Permalink
* object.c: Added examples for Object#is_a? and Object#instance_of?
Browse files Browse the repository at this point in the history
  patcheed from Manoj Kumar. [Bug ruby#5880] [ruby-core:42057]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
ayumin committed Jan 11, 2012
1 parent c6fb7c1 commit 32e6600
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Thu Jan 12 02:14:43 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>

* object.c: Added examples for Object#is_a? and
Object#instance_of? patcheed from Manoj Kumar.
[Bug #5880] [ruby-core:42057]

Thu Jan 12 00:57:48 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>

* lib/mkmf.rb: verbose-mode can use by RM, RMDIRS, etc.
Expand Down
19 changes: 15 additions & 4 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,15 @@ rb_obj_inspect(VALUE obj)
*
* Returns <code>true</code> if <i>obj</i> is an instance of the given
* class. See also <code>Object#kind_of?</code>.
*
* class A; end
* class B < A; end
* class C < B; end
*
* b = B.new
* b.instance_of? A #=> false
* b.instance_of? B #=> true
* b.instance_of? C #=> false
*/

VALUE
Expand Down Expand Up @@ -524,11 +533,13 @@ rb_obj_is_instance_of(VALUE obj, VALUE c)
* end
* class B < A; end
* class C < B; end
*
* b = B.new
* b.instance_of? A #=> false
* b.instance_of? B #=> true
* b.instance_of? C #=> false
* b.instance_of? M #=> false
* b.is_a? A #=> true
* b.is_a? B #=> true
* b.is_a? C #=> false
* b.is_a? M #=> true
*
* b.kind_of? A #=> true
* b.kind_of? B #=> true
* b.kind_of? C #=> false
Expand Down

0 comments on commit 32e6600

Please sign in to comment.