How should I capitalize Ruby? [closed]
RUBY? Ruby? ruby? What's good style?
I know the answer—I just wanted to make sure the question was out there and questioners were aware that there is a correct form.
Also, should I capitalize "gem" as "GEM"?
class TestLanguageName < Test::Unit::TestCase
def test_language_name
assert_correct_language_name StackOverflow.new.describ开发者_开发技巧e_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
Section 1.9 of ruby-doc.org FAQ says:
Officially, the language is called "Ruby". On most systems, it is invoked using the command "ruby". It's OK to use ruby instead of Ruby. Please don't use RUBY as the language name. Originally, or historically, it was called "ruby".
Either Ruby or ruby is correct.
The programming language is called Ruby (that's how they write it on the official site).
As for gems, the full name of the project is RubyGems, with inner-caps, but the things you produce for it are simply gems (unlike a lot of open-source projects, it doesn't stand for anything — it's just a pun on "Ruby").
As a side note, even though the language is "Ruby", the name of the official Ruby interpreter on most systems is ruby — the capitalization matters here because many filesystems are case-sensitive, so trying to run "Ruby" will get you a whole bunch of nothing. But to distinguish it from other Ruby interpreters, in conversation this implementation is usually called "MRI" (for "Matz's Ruby Interpreter").
精彩评论