Class: Netica::Environment
- Inherits:
-
Object
- Object
- Netica::Environment
- Includes:
- Singleton
- Defined in:
- lib/netica/environment.rb
Constant Summary collapse
- @@network_container =
[]
- @@processor =
nil
- @@redis =
nil
- @@logfile =
nil
Class Method Summary collapse
-
.engage(settings = {}) ⇒ Object
Initializes logging, a Netica Environ object and a connection to redis, if defined.
Instance Method Summary collapse
- #active_networks ⇒ Object
- #logfile_path ⇒ Object
- #network_container ⇒ Object
- #processor ⇒ Object
- #redis ⇒ Object
Class Method Details
.engage(settings = {}) ⇒ Object
Initializes logging, a Netica Environ object and a connection to redis, if defined.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/netica/environment.rb', line 17 def self.engage(settings = {}) if settings[:logfile] @@logfile = settings[:logfile] else @@logfile = "#{File.dirname(__FILE__)}/../../log/netica.log" end if settings[:license_key] @@processor = Java::NorsysNetica::Environ.new(settings[:license_key]) else @@processor = Java::NorsysNetica::Environ.new(nil) end #@@processor.control_concurrency("ExternalThreads", "OptimizeSafely") @@processor.control_concurrency("ExternalThreads", "Serialize") if settings[:redis] @@redis = Redis.new(settings[:redis]) end if settings[:network_container] @@network_container = settings[:network_container] else @@network_container = @@processor.active_networks end NeticaLogger.info "@@network_container is #{@@network_container.class} #{@@network_container.object_id}." NeticaLogger.info "Initializing the Netica Environment #{@@processor.object_id}" end |
Instance Method Details
#active_networks ⇒ Object
48 49 50 |
# File 'lib/netica/environment.rb', line 48 def active_networks @@network_container end |
#logfile_path ⇒ Object
60 61 62 |
# File 'lib/netica/environment.rb', line 60 def logfile_path @@logfile end |
#network_container ⇒ Object
52 53 54 |
# File 'lib/netica/environment.rb', line 52 def network_container @@network_container end |
#processor ⇒ Object
44 45 46 |
# File 'lib/netica/environment.rb', line 44 def processor @@processor end |
#redis ⇒ Object
56 57 58 |
# File 'lib/netica/environment.rb', line 56 def redis @@redis end |