SHOW:
|
|
- or go back to the newest paste.
1 | - | def self.included(base) |
1 | + | module Logger |
2 | - | puts "extending logger into: #{base.class}:#{base.__id__}" |
2 | + | module ClassMethods |
3 | def classmethod1 | |
4 | - | base.extend(LoggerClassMethods) |
4 | + | :foo |
5 | end | |
6 | ||
7 | def classmethod2 | |
8 | :bar | |
9 | end | |
10 | end | |
11 | ||
12 | def instancemethod1 | |
13 | :baz | |
14 | end | |
15 | ||
16 | def instancemethod2 | |
17 | :qux | |
18 | end | |
19 | ||
20 | def self.included(base) | |
21 | base.extend(ClassMethods) | |
22 | end | |
23 | end | |
24 | ||
25 | ||
26 | ||
27 | #how can i also use the module LoggerClassMethods to create instance methods instead of class methods with the self.included(base) hook? |