Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 39 lines (32 sloc) 0.536 kb
4e9fab3 @jredville added beget.rb and nesting.rb
authored
1 class BaseClass
2 def foo
3 puts "hi from baseclass"
4 end
5 end
6
7 module Begetter
8 def self.included(obj)
9 cls_name = obj.name + "Class"
10 newobj = Object.const_set cls_name, Class.new(::BaseClass)
11 newobj.send(:include, obj)
12 end
13 def bar
14 puts "calling baz"
15 baz
16 end
17
18 def initialize
19 puts "module initialize"
20 end
21 end
22
23 module Begetting
24 include Begetter
25 def baz
26 puts "hi from begetting"
27 end
28
29 def qux
30 puts "hi from qux"
31 end
32 end
33
34 obj = BegettingClass.new
35
36 obj.foo
37 obj.bar
38 obj.qux
Something went wrong with that request. Please try again.