mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-21 01:03:20 -04:00
Make method_missing public in the test framework for Ruby 1.9.
This commit is contained in:
@@ -89,6 +89,18 @@ class AboutMessagePassing < EdgeCase::Koan
|
|||||||
#
|
#
|
||||||
# If the method :method_missing causes the NoMethodError, then
|
# If the method :method_missing causes the NoMethodError, then
|
||||||
# what would happen if we redefine method_missing?
|
# what would happen if we redefine method_missing?
|
||||||
|
#
|
||||||
|
# NOTE:
|
||||||
|
#
|
||||||
|
# In Ruby 1.8 the method_missing method is public and can be
|
||||||
|
# called as shown above. However, in Ruby 1.9 the method_missing
|
||||||
|
# method is private. We explicitly made it public in the testing
|
||||||
|
# framework so this example works in both versions of Ruby. Just
|
||||||
|
# keep in mind you can't call method_missing like that in Ruby
|
||||||
|
# 1.9. normally.
|
||||||
|
#
|
||||||
|
# Thanks. We now return you to your regularly schedule Ruby
|
||||||
|
# Koans.
|
||||||
end
|
end
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ class Object
|
|||||||
self.send(method)
|
self.send(method)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
in_ruby_version("1.9") do
|
||||||
|
public :method_missing
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module EdgeCase
|
module EdgeCase
|
||||||
|
|||||||
Reference in New Issue
Block a user