Ruby/Method/binding
Материал из Wiki.crossplatform.ru
(Различия между версиями)
ViGOur (Обсуждение | вклад) м (1 версия: Импорт выборки материалов по Ruby) |
Текущая версия на 17:55, 13 сентября 2010
Bind a block to a method
def aMethod return binding end the_binding = aMethod { puts "hello" } eval "yield", the_binding # hello
Return a binding
def aMethod a = "local variable" return binding end the_binding = aMethod eval "a", the_binding # "local variable"