Guest User

Untitled

a guest
Apr 23rd, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. # This works
  2.  
  3. require 'rubygems'
  4. require 'activesupport'
  5.  
  6. class Base
  7. def self.cry
  8. "#{self.name}.cry called!"
  9. end
  10. end
  11.  
  12. module Behaviour
  13. def blame
  14. puts self.class.parent.const_get(:Child).cry
  15. end
  16. end
  17.  
  18. module Parent
  19. class Child < Base
  20. end
  21.  
  22. class Sibling < Base
  23. include Behaviour
  24. end
  25. end
  26.  
  27. sibling = Parent::Sibling.new
  28. sibling.blame # NameError here
Add Comment
Please, Sign In to add comment