Created
February 19, 2012 16:34
-
-
Save ileitch/1864555 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/kernel/bootstrap/kernel.rb b/kernel/bootstrap/kernel.rb | |
| index 06c3458..2dcb3f5 100644 | |
| --- a/kernel/bootstrap/kernel.rb | |
| +++ b/kernel/bootstrap/kernel.rb | |
| @@ -47,18 +47,6 @@ module Kernel | |
| raise PrimitiveFailure, "Kernel#object_id primitive failed" | |
| end | |
| - def respond_to?(meth, include_private=false) | |
| - Rubinius.primitive :object_respond_to_public | |
| - respond_to_all?(meth.to_sym, include_private); | |
| - end | |
| - | |
| - def respond_to_all?(meth, include) | |
| - Rubinius.primitive :object_respond_to | |
| - raise PrimitiveFailure, "Kernel#prim_respond_to? failed" | |
| - end | |
| - | |
| - private :respond_to_all? | |
| - | |
| def taint | |
| Rubinius.primitive :object_taint | |
| raise PrimitiveFailure, "Kernel#taint primitive failed" | |
| diff --git a/kernel/bootstrap/kernel18.rb b/kernel/bootstrap/kernel18.rb | |
| index d69acf2..2f9c91c 100644 | |
| --- a/kernel/bootstrap/kernel18.rb | |
| +++ b/kernel/bootstrap/kernel18.rb | |
| @@ -35,4 +35,16 @@ module Kernel | |
| __send__ message, *args | |
| end | |
| + | |
| + def respond_to?(meth, include_private=false) | |
| + Rubinius.primitive :object_respond_to_public | |
| + respond_to_all?(meth.to_sym, include_private); | |
| + end | |
| + | |
| + def respond_to_all?(meth, include) | |
| + Rubinius.primitive :object_respond_to | |
| + raise PrimitiveFailure, "Kernel#prim_respond_to? failed" | |
| + end | |
| + | |
| + private :respond_to_all? | |
| end | |
| diff --git a/kernel/bootstrap/kernel19.rb b/kernel/bootstrap/kernel19.rb | |
| index df34f12..f555f6f 100644 | |
| --- a/kernel/bootstrap/kernel19.rb | |
| +++ b/kernel/bootstrap/kernel19.rb | |
| @@ -32,4 +32,34 @@ module Kernel | |
| Rubinius.primitive :object_untrusted_p | |
| raise PrimitiveFailure, "Kernel#untrusted? primitive failed" | |
| end | |
| + | |
| + def respond_to?(meth, include_private=false) | |
| + if respond_to_prim?(meth, include_private) | |
| + true | |
| + else | |
| + if respond_to_missing?(meth, include_private) == false | |
| + false | |
| + else | |
| + true | |
| + end | |
| + end | |
| + end | |
| + | |
| + def respond_to_missing?(meth, include) | |
| + false | |
| + end | |
| + | |
| + def respond_to_prim?(meth, include_private) | |
| + Rubinius.primitive :object_respond_to_public | |
| + respond_to_all?(meth.to_sym, include_private); | |
| + end | |
| + | |
| + private :respond_to_prim? | |
| + | |
| + def respond_to_all?(meth, include) | |
| + Rubinius.primitive :object_respond_to | |
| + respond_to_missing?(meth, include) | |
| + end | |
| + | |
| + private :respond_to_all? | |
| end | |
| diff --git a/spec/tags/19/ruby/core/kernel/respond_to_missing_tags.txt b/spec/tags/19/ruby/core/kernel/respond_to_missing_tags.txt | |
| index 4312650..656f93c 100644 | |
| --- a/spec/tags/19/ruby/core/kernel/respond_to_missing_tags.txt | |
| +++ b/spec/tags/19/ruby/core/kernel/respond_to_missing_tags.txt | |
| @@ -1,8 +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? 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? is not called when #respond_to? would return true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment