Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有三个 ruby 脚本,说A.rb,B.rb和Call.rb.
A.rb
B.rb
Call.rb
我有一个类变量@@classvar,Call.rb我正在初始化它, @@classvar=[:A,:B].
@@classvar
@@classvar=[:A,:B]
上面的语句实际上做了什么?
这意味着,将类方法或具有名称的静态方法设置classvar为具有两个符号的数组,:A和:B。
classvar
:A
:B