class CatEngine::Engine

Public Class Methods

compile() click to toggle source
# File lib/cat_engine/engine.rb, line 10
def self.compile
  gmcs = [`which gmcs`.chomp, `which mcs`.chomp].find { |path| path != "" }
  system "cd #{CatEngine.cat_engine_source_path} && #{gmcs} -debug -out:#{CatEngine.cat_engine_executable_path} *.cs"
end

Public Instance Methods

process(id, history) click to toggle source
# File lib/cat_engine/engine.rb, line 15
def process id, history
  command = %(cd #{CatEngine.cat_path} && mono --debug #{CatEngine.cat_engine_executable_path} "#{id}" #{history} 2>&1)
  output = `#{command}`.chomp
  if $?.success?
    Nokogiri::XML.parse(output, nil, "utf-8")
  else
    raise EngineError.new(output)
  end
end
valid_history?(id, history) click to toggle source
# File lib/cat_engine/engine.rb, line 26
def valid_history? id, history
  process id, history
  true
rescue EngineError => e
  false
end