Class: RbEAI::SazParser

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

Instance Method Summary collapse

Constructor Details

#initialize(node, expression) ⇒ SazParser

Returns a new instance of SazParser.



137
138
139
140
# File 'lib/rbeai/RouterLogic.rb', line 137

def initialize(node, expression)
  @resultList = node.elements["."].text
  @node = expression
end

Instance Method Details

#match(file) ⇒ Object



142
143
144
145
146
147
148
149
150
151
# File 'lib/rbeai/RouterLogic.rb', line 142

def match(file)    
  result = "nil"
  f = File.new(file)
  parser = Parsers::SAX2Parser.new( f )
  parser.listen( :characters , @node) do |text| 
    result = text  if @resultList.include?(text)
  end
  parser.parse
  return @resultList.include?(result)
end