Guest User

Untitled

a guest
Dec 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. module B
  2. def B.included(mod)
  3. if mod.method_defined?("john")
  4. mod.send :define_method, :hello_world do
  5. puts "greenland"
  6. end
  7. end
  8. end
  9. end
  10.  
  11.  
  12. class A
  13. def john
  14. puts "john was called"
  15. end
  16. include B
  17. end
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. A.new.hello_world # => A does NOT have method john
Add Comment
Please, Sign In to add comment