作者LCamel (LCamel)
看板Ruby
標題[心得] 看似遞迴..
時間Sun Dec 9 22:28:15 2007
actionpack-1.13.6/lib/action_controller/routing.rb
465 # Write the real recognition implementation and then resend the message.
466 def recognize(path, environment={})
467 write_recognition
468 recognize path, environment
469 end
實驗:
$ cat ~/a.rb
o = Object.new
def o.foo
puts "1"
instance_eval("def foo; puts 'hi'; end")
puts "2"
foo
puts "3"
end
o.foo
puts "==========="
o.foo
$ ruby a.rb
1
2
hi
3
===========
hi
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.167.155.183
1F:推 LyinZ:真噁心 @_@ 12/09 22:32
2F:推 godfat:這大概可以說是自我更新吧 @_@b 12/09 22:34