这是红宝石Koans的摘录。
in_ruby_version("mri") do
RubyConstant = "What is the sound of one hand clapping?"
def test_constants_become_symbols
all_symbols_as_strings = Symbol.all_symbols.map { |x| x.to_s }
assert_equal true, all_symbols_as_strings.include?(:RubyConstant)
end
end
在in_ruby_verion前面没有任何修饰符的方法是什么?这是什么构造。
答案 0 :(得分:0)
它实际上只是一个方法调用。有趣的是它传递了一个块,(do
end
符号)。