Ruby类声明语法

Ruby类声明语法,ruby,Ruby,我已经阅读了文件中的这两行代码:这是类声明的开头 class Myclass::Event class DeprecatedMethod < StandardError; end 但是拥有这样的东西意味着什么呢 class Myclass::Event class DeprecatedMethod < StandardError; end // whatdoes this line means ? // body of the classe here : me

我已经阅读了文件中的这两行代码:这是类声明的开头

class Myclass::Event

  class DeprecatedMethod < StandardError; end
但是拥有这样的东西意味着什么呢

class Myclass::Event
   class DeprecatedMethod < StandardError; end // whatdoes this line means ?  

  // body of the classe here : methods and so on...
   end
class Myclass::Event
类DeprecatedMethod
第二行在
LogStash::Event
中声明
DeprecatedMethod
。因此,该类的完全限定名(FQN)是
LogStash::Event::DeprecatedMethod
。此外,此类是
StandardError
的子类

我知道第一行声明了一个名为Event的类


差不多。第一行打开一个类声明。如果没有匹配的
end
,则它是不完整的,如果这两行都是文件中的代码,则会产生语法错误。第二行是一个完整的声明(有匹配的
end
)。

DeprecatedMethod
是class
StandardError
中的一个子类。卢卡斯巴利亚克:是的,但这可能与这里无关。也许他不明白
DeprecatedMethod
的确切意思:)@卢卡斯巴利亚克:是的,也许:)@SergioTulentsev如果我不清楚,很抱歉。我刚刚更新了我的问题。请指定您的问题。你到底想解释什么?@LukasBaliak如果我不清楚很抱歉。我刚刚更新了我的问题。好的,你的答案是@SergioTulentsev。
class Myclass::Event
   class DeprecatedMethod < StandardError; end // whatdoes this line means ?  

  // body of the classe here : methods and so on...
   end