class CatEngine::FlatEngine

Attributes

full_history[RW]
id[RW]

Public Class Methods

new(full_history = []) click to toggle source
# File lib/cat_engine/flat_engine.rb, line 6
def initialize full_history = []
  self.full_history = full_history
end

Public Instance Methods

process(id, history) click to toggle source
# File lib/cat_engine/flat_engine.rb, line 11
def process id, history
  self.id = id

  doc = Nokogiri.parse(form)
  item = doc.root.css("Item").reject do |item|
    full_history.include?(item["FormItemOID"])
  end.first

  doc.root.children.each(&:unlink)
  if item
    item.parent = doc.root
  else
    doc.root = doc.create_element("Results")
  end

  doc
end
valid_history?(id, history) click to toggle source
# File lib/cat_engine/flat_engine.rb, line 29
def valid_history? id, history
  true
end

Private Instance Methods

form() click to toggle source
# File lib/cat_engine/flat_engine.rb, line 35
def form
  File.read("#{CatEngine.cat_path}/forms/#{id}.xml")
end