Guest User

Untitled

a guest
Jun 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. module A
  2. end
  3.  
  4. module B
  5. end
  6.  
  7. module A::A1
  8. module_function
  9. def test
  10. puts "hola"
  11. end
  12. end
  13.  
  14. module A::A2
  15. module_function
  16. def test2
  17. A1.test
  18. end
  19. end
  20.  
  21. module B
  22. module B1
  23. module_function
  24. def test
  25. puts "bolas"
  26. end
  27. end
  28. end
  29.  
  30. module B
  31. module B2
  32. module_function
  33. def test2
  34. B1.test
  35. end
  36. end
  37. end
  38.  
  39. B::B2.test2 # => "bolas"
  40. A::A2.test2 # => NameError: uninitialized constant A::A2::A1
Add Comment
Please, Sign In to add comment