Skip to content

Commit 6cd71fb

Browse files
committed
Implement rb_respond_to in Ruby to cover primitive cases
1 parent f0c3d6a commit 6cd71fb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/truffle/truffle/cext.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,10 @@ def rb_funcall_with_block(recv, meth, args, block)
947947
recv.public_send(meth, *args, &block)
948948
end
949949

950+
def rb_respond_to(object, name)
951+
object.respond_to?(name)
952+
end
953+
950954
def rb_funcallv_public(recv, meth, args)
951955
recv.public_send(meth, *args)
952956
end

src/main/c/cext/ruby.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ char* ruby_strdup(const char *str) {
18921892
// Calls
18931893

18941894
int rb_respond_to(VALUE object, ID name) {
1895-
return polyglot_as_boolean(RUBY_INVOKE_NO_WRAP(object, "respond_to?", name));
1895+
return RUBY_CEXT_INVOKE("rb_respond_to", object, ID2SYM(name));
18961896
}
18971897

18981898
VALUE rb_funcallv(VALUE object, ID name, int args_count, const VALUE *args) {

0 commit comments

Comments
 (0)