Method: CShadow::Library#initialize

Defined in:
lib/cgen/cshadow.rb

#initialize(*args) ⇒ Library

:nodoc:



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/cgen/cshadow.rb', line 252

def initialize(*args)  # :nodoc:
  super
  
  before_commit do
    @classes_to_commit = []
    ObjectSpace.each_object(CShadowClassMethods) do |cl|
      if cl.shadow_library == self
        @classes_to_commit << cl
      end
    end

    # This is done here, rather than in #inherited, to get around
    # the Ruby bug with names of nested classes. It's ugly...
    ## this may be fixed in 1.7
    # Better: register classes with libraries...
    
    classes = Library.sort_class_tree(@classes_to_commit)
    
    classes.each do |cl|
      cl.fill_in_defs
    end
  end

  after_commit do
    for cl in @classes_to_commit
      cl.protect_shadow_attrs
    end
  end
end