mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-19 00:33:20 -04:00
Updated with Rubinius Support
This commit is contained in:
@@ -13,13 +13,18 @@ end
|
||||
def ruby_version?(version)
|
||||
RUBY_VERSION =~ /^#{version}/ ||
|
||||
(version == 'jruby' && defined?(JRUBY_VERSION)) ||
|
||||
(version == 'mri' && ! defined?(JRUBY_VERSION))
|
||||
(version == 'mri' && (! defined?(JRUBY_VERSION) && ! defined?(Rubinius))) ||
|
||||
(version == 'rbx' && defined?(Rubinius))
|
||||
end
|
||||
|
||||
def in_ruby_version(*versions)
|
||||
yield if versions.any? { |v| ruby_version?(v) }
|
||||
end
|
||||
|
||||
def not_in_ruby_version(*versions)
|
||||
yield unless versions.any? { |v| ruby_version?(v) }
|
||||
end
|
||||
|
||||
# Standard, generic replacement value.
|
||||
# If value19 is given, it is used inplace of value for Ruby 1.9.
|
||||
def __(value="FILL ME IN", value19=:mu)
|
||||
@@ -52,7 +57,7 @@ class Object
|
||||
end
|
||||
end
|
||||
|
||||
in_ruby_version("1.9") do
|
||||
in_ruby_version("1.9", "rbx") do
|
||||
public :method_missing
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user