How should I capitalize Ruby? [closed]

时间秒杀一切 提交于 2019-11-26 22:04:52

问题


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.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

回答1:


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.




回答2:


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").



来源:https://stackoverflow.com/questions/6053240/how-should-i-capitalize-ruby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!