Skip to content

Commit

Permalink
Object#inspect does not need to check if Cocoa class responds to #des…
Browse files Browse the repository at this point in the history
…cription

`#description` is required to conform to the NSObject protocol.
  • Loading branch information
ferrous26 committed Mar 11, 2012
1 parent 0d5cf1d commit 32067bc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,7 @@ rb_obj_inspect(VALUE obj, SEL sel)
}
}
else if (!SPECIAL_CONST_P(obj) && !RCLASS_RUBY(RBASIC(obj)->klass)) {
if (rb_vm_respond_to(obj, selDescription, false)) {
return rb_str_new3(rb_vm_call(obj, selDescription, 0, 0));
}
return rb_str_new3(rb_vm_call(obj, selDescription, 0, 0));
}
return rb_funcall(obj, rb_intern("to_s"), 0, 0);
}
Expand Down

0 comments on commit 32067bc

Please sign in to comment.