Class: MINT::Agent

Inherits:
Object
  • Object
show all
Defined in:
lib/MINT-core/agent/agent.rb

Direct Known Subclasses

AUIAgent, LayoutAgent

Instance Attribute Summary collapse

Instance Method Summary collapse

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(connection_options = { :adapter => "redis", :host =>"localhost",:port=>6379})
  DataMapper.setup(:default, connection_options)
  DRb.start_service
  @running_mappings = []
#       DataMapper::Logger.new("data.log", :debug)
end

Instance Attribute Details

#running_mappingsObject (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

#runObject



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