Module: Mrdf_Repository
- Includes:
- Mmtk_helper
- Included in:
- Crdf_Repository
- Defined in:
- lib/ontomde-core/meta.rb,
lib/ontomde-core/helper.rb,
lib/ontomde-core/context.rb,
lib/ontomde-core/inspector.rb,
lib/ontomde-core/resourceSet.rb
Constant Summary
Constants included from Mmtk_helper
Mmtk_helper::MTK_WRITE_SESSION_FILE_NAMES, Mmtk_helper::NOREVERSE, Mmtk_helper::REVERSE, Mmtk_helper::TEMP_FILE_SUFFIX, Mmtk_helper::WITHOUT_MARKER
Instance Attribute Summary
Attributes included from Mmtk_helper
Instance Method Summary collapse
-
#context ⇒ Object
returns context hastable.
- #inspector_start_daemon(fileName) ⇒ Object
-
#mtk_context(*additional_context, &block) ⇒ Object
Defines context variables for use in block passed as parameter.
-
#mtk_default_context(*additional_context, &block) ⇒ Object
Similar to mtk_context but preserves already defined context.
- #mtk_object_message ⇒ Object
- #mtk_related_message ⇒ Object
Methods included from Mmtk_helper
#encloseWrite, #mtk_annotation, #mtk_autoNewFileCreationCheck, #mtk_out, #mtk_protected, #mtk_qualifyBlockURI, #mtk_retrieveProtected, #mtk_shouldAlreadyBeenReversed, #mtk_sprotected, #mtk_stringWriteSession, #mtk_stss, #mtk_wprotected, #mtk_writeSession, #mtk_writeSessionNameClashErrorDetection, #notifyFileGenerated, #write
Instance Method Details
#context ⇒ Object
returns context hastable.
Context is used for saving any information usefull for ontomde, such as current file being written, database persistence mode, …
Please refer to #WarningHash [] method for information on how to access context content.
Please refer to #mtk_context method for information on how to populate context.
54 55 56 |
# File 'lib/ontomde-core/context.rb', line 54 def context return Thread.current["@@context"] end |
#inspector_start_daemon(fileName) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/ontomde-core/inspector.rb', line 13 def inspector_start_daemon(fileName) set_model_for_inspector(self) Dir.chdir(File.dirname(__FILE__)) Dir.chdir('inspector/rails') load('script/server') end |
#mtk_context(*additional_context, &block) ⇒ Object
Defines context variables for use in block passed as parameter. Existing context variable are redefined. (cf. mtk_default_context ) When exiting block, previously defined context variables are restored.
Example 1:
mtk_context( :build => "build\", :option => true) {
your-code
puts context[:build]
your-code
puts context[:option]
your-code
}
Example 2:
mtk_context( :build => "BUILD_ONE\") {
your-code
puts context[:build] # BUILD_ONE
mtk_context( :build => "NEW_DIR", :option => true) {
your-code
puts context[:build] # NEW_DIR\
your-code
puts context[:option]
your-code
}
puts context[:build] # BUILD_ONE
}
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ontomde-core/context.rb', line 95 def mtk_context(*additional_context,&block) context_save=Thread.current["@@context"] Thread.current["@@context"]=context_save.clone additional_context.each { |item| item.each { |k,v| Thread.current["@@context"][k]=v }} yield Thread.current["@@context"]=context_save return nil end |
#mtk_default_context(*additional_context, &block) ⇒ Object
Similar to mtk_context but preserves already defined context. Used to provide a default context.
60 61 62 63 64 65 66 67 |
# File 'lib/ontomde-core/context.rb', line 60 def mtk_default_context(*additional_context,&block) filtered_context=Array.new additional_context.each { |item| item.each { |k,v| next if Thread.current["@@context"].include?(k) filtered_context << item }} mtk_context(*filtered_context,&block) end |
#mtk_object_message ⇒ Object
350 351 352 |
# File 'lib/ontomde-core/meta.rb', line 350 def return '' end |
#mtk_related_message ⇒ Object
353 354 355 |
# File 'lib/ontomde-core/meta.rb', line 353 def return '' end |