[心得] 看似遞迴..
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
推
12/09 22:32, , 1F
12/09 22:32, 1F
推
12/09 22:34, , 2F
12/09 22:34, 2F
Ruby 近期熱門文章
PTT數位生活區 即時熱門文章