为什么要把回调参数设计成一个Module?

Why design the callback parameter as a Module?

根据 EventMachine.watch_file 的文档,handler 参数必须是一个模块(或从 EventMachine::FileWatch 继承的 class)。为什么要这样设计?对我来说,块(或 Proc)参数会更自然和灵活(因为它允许通过闭包使用局部变量)...

文档不是很清楚,但您也可以提供 FileWatch 的子 class。那会让你更容易地使用当地人。

它要么采用具有所需方法的模块,要么采用具有所需方法的 class AND 它必须是 class 的子模块想要 class.

采取look at the code, specifically, the klass_from_handler方法。