Sha256: 64b17367963d60e60c8dcfe624c86d7e75755b0d2b0b8928a9a9b7361052b62a

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

#:include: ../shared/license.rdoc

require 'singleton'

class ProfilDefault
end

class ProfilDefaultSingleton < ProfilDefault
	include Singleton
end

#Profil racine.
#Toutes les extensions doivent être sous cet espace de nom.
module Mmtk_Profil
end

class Module 
#Inclure le module courant dans le module principal de la métaclasse correspondante. (sucre syntaxique)
#
#Exemple: 
#module ProfileJava
#module Muml_NamedElement
#	def doThis 
#	end
#end
	def method_added(a)
		#log.debug "method added!! #{a} #{name}"
		#Module.nesting.each { |n| print("#{n.name},") }
		#super
		mtk_register if(a!=:mtk_register && a!=:method_added)
	end
	def mtk_register
		n=""; (ns=name.split(/::/)).each { |n| }
		#log.debug "registering #{name} #{ns[0]}"
		return if ns[0]!="Mmtk_Profil"
		@mtk_registered|=false
		return if @mtk_registered
		@mtk_registered=true

		cn=n.clone ; cn[0]="C"
		log.debug "Registering #{name} in #{n}"

		cmd="module #{name}\ndef mtk_hello\nprint(\"\\n>#{name}\")\nsuper\nend\nend\n"
		cmd=cmd+"module ::#{n}\ninclude #{name}\nend\n"
		if( :"#{cn}"==:Crdf_Resource )
			#TODO: HACK: module dynamique
			#log.debug "Re-Registering #{cn} in #{n}"
			sc= (:"#{cn}"!=:Crdf_Resource) ? "< ::Crdfs_Class ":""
			#log.debug "sc : #{sc} #{cn}" 
			cmd=cmd+"class ::#{cn}\ninclude ::#{n}\nend\n"
			#log.debug "class ::#{cn}\ninclude ::#{n}\nend\n"
		end
		eval(cmd)
	end
end

class Crdf_Resource
	def mtk_hello
		log.debug "\n>#{self.class.name}->Crdf_Resource::mtk_hello"
	end
end	

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ontomde-core-1.0.2 lib/ontomde-core/profil.rb