Class: MINT::Agent
- Inherits:
-
Object
- Object
- MINT::Agent
- Defined in:
- lib/MINT-core/agent/agent.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#running_mappings ⇒ Object
readonly
Returns the value of attribute running_mappings.
Instance Method Summary collapse
- #addMapping(mapping) ⇒ Object
-
#initialize(connection_options = { :adapter => "redis", :host =>"localhost",:port=>6379}) ⇒ Agent
constructor
A new instance of Agent.
- #run ⇒ Object
Constructor Details
#initialize(connection_options = { :adapter => "redis", :host =>"localhost",:port=>6379}) ⇒ Agent
Returns a new instance of Agent.
6 7 8 9 10 11 |
# File 'lib/MINT-core/agent/agent.rb', line 6 def initialize( = { :adapter => "redis", :host =>"localhost",:port=>6379}) DataMapper.setup(:default, ) DRb.start_service @running_mappings = [] # DataMapper::Logger.new("data.log", :debug) end |
Instance Attribute Details
#running_mappings ⇒ Object (readonly)
Returns the value of attribute running_mappings.
4 5 6 |
# File 'lib/MINT-core/agent/agent.rb', line 4 def running_mappings @running_mappings end |
Instance Method Details
#addMapping(mapping) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/MINT-core/agent/agent.rb', line 13 def addMapping(mapping) m = mapping.execute if not m.is_a? Array m= [m] end @running_mappings += m end |
#run ⇒ Object
22 23 24 25 26 |
# File 'lib/MINT-core/agent/agent.rb', line 22 def run @running_mappings.each do |thread| thread.join end end |