banister / object2module

Convert Classes and Objects to Modules so they can be extended/included.
MIT License
9 stars 0 forks source link

Nested includes do not appear to work #1

Closed banister closed 14 years ago

banister commented 14 years ago
class A
  def hello; :hello; end
end

class B
  gen_include A
end

class C
  gen_include B
end

C.new.hello #=> NoMethod
banister commented 14 years ago

This is because of the way that module inclusino works...if the module is an ICLASS it mixes in the klass pointer; but in the case of an 'object module' (object turned into module) the klass pointer points to a non-module (i.e the object or class) and so module inclusion doesn't work

banister commented 14 years ago

completely changed way doing Object2module now.. was doing it a very silly way. All needed to do was remove T_MODULE check from rb_include_module() and copy-pasta func from class.c