Crystal 有静态方法吗?

Has Crystal got static methods?

是否可以像 Ruby 那样在模块中执行静态方法?

module Test
    self.def test
        puts "test"
    end
end
Test::test

如果调用在同一个文件中(如示例中所示),我得到 expecting token 'EOF', not 'end',如果我将调用放在不同的文件中,我得到 expecting token 'CONST', not 'test'

我做错了什么? Crystal 中的模块中是否有静态方法?

class 方法的正确语法是 def self.test,而不是 self.def test。 Class 方法是使用 Test.test 调用的,而不是 Test::test.