Guest User

Untitled

a guest
Jul 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. module A
  2. def self.init_on(target)
  3. target.foo = 123
  4. end
  5. end
  6.  
  7. $base_module = A
  8.  
  9.  
  10. module Test
  11. C = Struct.new(:id) do
  12. include $base_module
  13.  
  14. @@base = $base_module
  15.  
  16. def initialize
  17. @@base.init_on(self)
  18. end
  19.  
  20. attr_accessor :foo
  21. end
  22. end
  23.  
  24. c = Test::C.new
  25. puts c.foo
Add Comment
Please, Sign In to add comment