红宝石?红宝石?红宝石?什么风格好?
我知道答案——我只是想确保问题存在并且提问者知道有一个正确的形式。
另外,我应该将“gem”大写为“GEM”吗?
class TestLanguageName < Test::Unit::TestCase
def test_language_name
assert_correct_language_name StackOverflow.new.describe_language("RuBy")
end
end
class StackOverflow
def describe_language(string)
# Which of the following?
methods = [:upcase, :capitalize, :downcase]
string.send(methods[rand(3)])
end
end