Class: Cirrocumulus::Environment
- Inherits:
-
Object
- Object
- Cirrocumulus::Environment
- Defined in:
- lib/cirrocumulus/environment.rb
Overview
Cirrocumulus environment. It is a container where all ontologies will be loaded.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Environment
constructor
A new instance of Environment.
- #join ⇒ Object
-
#load_ontology(ontology_instance) ⇒ Object
Loads ontology instance into environment.
-
#run ⇒ Object
Runs the environment.
Constructor Details
#initialize(name) ⇒ Environment
Returns a new instance of Environment.
15 16 17 18 19 20 21 |
# File 'lib/cirrocumulus/environment.rb', line 15 def initialize(name) Log4r::Logger['agent'].info "Loading #{name} Cirrocumulus environment" @name = name @ontologies = [] @@instance = self end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/cirrocumulus/environment.rb', line 13 def name @name end |
Class Method Details
.current ⇒ Object
9 10 11 |
# File 'lib/cirrocumulus/environment.rb', line 9 def self.current @@instance end |
Instance Method Details
#join ⇒ Object
39 40 41 |
# File 'lib/cirrocumulus/environment.rb', line 39 def join @ontologies.each {|ontology| ontology.join } end |
#load_ontology(ontology_instance) ⇒ Object
Loads ontology instance into environment.
26 27 28 29 |
# File 'lib/cirrocumulus/environment.rb', line 26 def load_ontology(ontology_instance) Log4r::Logger['agent'].info "Adding #{ontology_instance.name} ontology" @ontologies << ontology_instance end |
#run ⇒ Object
Runs the environment. It will also restore all loaded ontologies states.
34 35 36 37 |
# File 'lib/cirrocumulus/environment.rb', line 34 def run @ontologies.each {|ontology| ontology.restore_state } @ontologies.each {|ontology| ontology.run } end |