Что означает @в следующем коде Ruby:
module TestRocket
extend Module.new { attr_accessor :out }
def _test(a, b); send((call rescue()) ? a : b); end
def [email protected]; _show _test :_pass, :_fail end
def [email protected]; _show _test :_fail, :_pass end
def [email protected]; _show _pend; end
def [email protected]; _show _desc; end
def _show(r); (TestRocket.out || $>) << r; r end
def _pass; " OK\n"; end
def _fail; " FAIL @ #{source_location * ':'}\n"; end
def _pend; "PENDING '#{call}' @ #{source_location * ':'}\n"; end
def _desc; " FIRE '#{call}'!\n"; end
end
Proc.send :include, TestRocket
Затем это используется как:
+-> { Die.new(2) }
--> { raise }
+-> { 2 + 2 == 4 }
Как @превращается в '- > ' в имя функции?