2006/11/25 00:24
[컴퓨터]
1 2 3 4 5 6 7 8 |
puts "Method name: " meth_name = gets puts "Line of code: " code = gets string = %[def #{meth_name}\n #{code}\n end] eval(string) eval(meth_name) |
위의 간단한 예에서 함수이름과 코드를 입력받아 함수를 정의하고 실행한다.
