Permalink
Browse files

Allow to inherit from Cplus2Ruby::Entity instead

of including Cplus2Ruby.
  • Loading branch information...
1 parent eac862c commit 3bc8dcb9b38a655bd9e447dd398a4ea5ff74c910 @mneumann committed Feb 7, 2008
Showing with 9 additions and 3 deletions.
  1. +9 −3 cplus2ruby.rb
View
@@ -247,7 +247,13 @@ def self.compile_and_load(file, cflags="", libs="")
end
require "#{dir}/#{mod}.#{Config::CONFIG['DLEXT']}"
end
+end
+class Cplus2Ruby::Entity
+ def self.inherited(klass)
+ super
+ klass.class_eval "include ::Cplus2Ruby"
+ end
end
class Cplus2Ruby::Model
@@ -740,10 +746,10 @@ def class_bodies(out)
def class_declaration(model_class, out)
out << "struct #{model_class.klass.name}"
sc = model_class.klass.superclass
- if sc != Object
- sc = sc.name
- else
+ if sc == Object or sc == Cplus2Ruby::Entity
sc = "RubyObject"
+ else
+ sc = sc.name
end
out << " : #{sc}\n" if sc

0 comments on commit 3bc8dcb

Please sign in to comment.