Guest User

Untitled

a guest
Feb 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1.  
  2. module Foo
  3.  
  4. def self.included(base)
  5. base.class_eval do
  6. extend ClassMethods
  7. include InstanceMethods
  8. end
  9. end
  10.  
  11. module ClassMethods
  12. def c
  13. puts 'i am class method'
  14. puts self
  15. p = self.new
  16. p.i
  17. end
  18. end
  19.  
  20. module InstanceMethods
  21. def i
  22. puts ' i am instance method'
  23. end
  24. end
  25.  
  26. end
  27.  
  28. class Person
  29. include Foo
  30. end
  31.  
  32. Person.c
  33. # Person.new.i
Add Comment
Please, Sign In to add comment