Access denied, Please sign in and make sure you have proper permission.
赞。
吐个槽,文中只有局限性 (limitation),没有介绍到坏处 (cons)
暂时还没深入了解坏处。
哈哈我是吐槽标题,不是 pros 和 cons 嘛。
开个小玩笑。
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
来包裹了。