module LightIO::Module::Base::NewHelper

Protected Instance Methods

define_new_for_module(mod) click to toggle source
# File lib/lightio/module/base.rb, line 25
      def define_new_for_module(mod)
        LightIO::Module.send(:module_eval, <<-STR, __FILE__, __LINE__ + 1)
          module #{mod}
            module ClassMethods
              def new(*args, &blk)
                obj = LightIO::Library::#{mod}.__send__ :allocate
                obj.__send__ :initialize, *args, &blk
                obj
              end
            end
          end
        STR
      end
define_new_for_modules(*mods) click to toggle source
# File lib/lightio/module/base.rb, line 21
def define_new_for_modules(*mods)
  mods.each {|mod| define_new_for_module(mod)}
end