Guest User

Untitled

a guest
Apr 23rd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. require 'binding_of_caller'
  2.  
  3. class Module
  4. alias_method :omf, :module_function
  5.  
  6. def module_function
  7. Binding.of_caller do |binding|
  8. eval "omf", binding
  9. end
  10. end
  11. end
  12.  
  13. module X
  14. module_function
  15. def g
  16. end
  17. end
  18.  
  19. X.g
  20. # undefined method `g' for X:Module (NoMethodError)
Add Comment
Please, Sign In to add comment