Class: RbEAI::RouterLogic

Inherits:
Object
  • Object
show all
Defined in:
lib/rbeai/RouterLogic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xmlDoc) ⇒ RouterLogic

Returns a new instance of RouterLogic.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rbeai/RouterLogic.rb', line 14

def initialize(xmlDoc)
  @destinations = []
  XPath.each(xmlDoc, "./next/goto[count(when) > 0]") do |el|      
    taskname = el.attributes["task"]
    @destinations << [taskname, LogicFilter.new(el)]
  end
  XPath.each(xmlDoc, "./next/goto[count(when) = 0]") do |el|
    taskname = el.attributes["task"]
    @destinations << [taskname, LogicFilter.new(el)]
  end    
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



12
13
14
# File 'lib/rbeai/RouterLogic.rb', line 12

def default
  @default
end

#destinationsObject

Returns the value of attribute destinations.



12
13
14
# File 'lib/rbeai/RouterLogic.rb', line 12

def destinations
  @destinations
end

Instance Method Details

#enroute(file) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rbeai/RouterLogic.rb', line 26

def enroute(file)
  targettask = nil
  
  @destinations.each do | item |
    taskname = item[0]
    filter = item[1]      
    if filter.match(file)
      targettask = taskname
      break
    end
  end
      
  return targettask
end