Skip to content
Permalink
Browse files

Merge pull request #541 from krekoten/kernel_respond_to_missing

Implemented Kernel#respond_to_missing? (almost)
  • Loading branch information
alex committed Mar 22, 2013
2 parents f118a84 + e887d70 commit 8d8e46c9bcd49ea7a42f0c316813ac85cf9c6be2
Showing with 13 additions and 10 deletions.
  1. +0 −9 spec/tags/core/kernel/respond_to_missing_tags.txt
  2. +13 −1 topaz/modules/kernel.py
@@ -1,10 +1 @@
fails:Kernel#respond_to_missing? is called with a 2nd argument of false when #respond_to? is
fails:Kernel#respond_to_missing? is called a 2nd argument of false when #respond_to? is called with only 1 argument
fails:Kernel#respond_to_missing? is called with true as the second argument when #respond_to? is
fails:Kernel#respond_to_missing? is called when #respond_to? would return false
fails:Kernel#respond_to_missing? causes #respond_to? to return true if called and not returning false
fails:Kernel#respond_to_missing? causes #respond_to? to return false if called and returning false
fails:Kernel#respond_to_missing? causes #respond_to? to return false if called and returning nil
fails:Kernel#respond_to_missing? is called when obj responds to the given private method, include_private = false
fails:Kernel#respond_to_missing? is called for missing class methods
fails:Kernel#respond_to_missing? returns true if obj responds to the given public method
@@ -233,7 +233,19 @@ def method_instance_variable_definedp(self, space, name):

@moduledef.method("respond_to?", include_private="bool")
def method_respond_top(self, space, w_name, include_private=False):
return space.newbool(space.respond_to(self, w_name))
if space.respond_to(self, w_name):
return space.newbool(True)

w_found = space.send(
self,
space.newsymbol("respond_to_missing?"),
[w_name, space.newbool(include_private)]
)
return space.newbool(space.is_true(w_found))

@moduledef.method("respond_to_missing?")
def method_respond_to_missingp(self, space, w_name, w_include_private):
return space.newbool(False)

@moduledef.method("dup")
def method_dup(self, space):

0 comments on commit 8d8e46c

Please sign in to comment.