Class: RbEAI::RouterLogic
- Inherits:
-
Object
- Object
- RbEAI::RouterLogic
- Defined in:
- lib/rbeai/RouterLogic.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#destinations ⇒ Object
Returns the value of attribute destinations.
Instance Method Summary collapse
- #enroute(file) ⇒ Object
-
#initialize(xmlDoc) ⇒ RouterLogic
constructor
A new instance of RouterLogic.
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
#default ⇒ Object
Returns the value of attribute default.
12 13 14 |
# File 'lib/rbeai/RouterLogic.rb', line 12 def default @default end |
#destinations ⇒ Object
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 |