def method_with_print
using A
p "begin method"
puts "This is '#{self.method(:method_with_print).name}' method"
p "end method"
end
test.rb:2:in `using': main.using is permitted only at toplevel (RuntimeError)
from test.rb:2:in `method_with_print'
from test.rb:17:in `<main>'
Ruby 版本是?我记得新版本的 Ruby 是不支持在顶层作用域使用细化。如果要using
得用 module
来包裹了。