Ruby/Method/send

Материал из Wiki.crossplatform.ru

(Различия между версиями)
Перейти к: навигация, поиск

Версия 17:10, 26 мая 2010

Built-In Reflection

my_string = "times"
3.send(my_string) { print "Hello "}



Calling Methods Dynamically

"this is a test".send(:length) # 13 
"this is a sub".send("sub", /iles/, ".")