Class: RbEAI::TransfLogic

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xmlDoc) ⇒ TransfLogic

Returns a new instance of TransfLogic.



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

def initialize(xmlDoc)
  @transfs = []    
  # Detect simple usage of one transformation not ordered
  el = XPath.first(xmlDoc, "./transf[count(@ord) = 0]")
  if el != nil
    @transfs[0] = TransfScript.new(el)
  else
    # Case of multiple ordered transformations
    XPath.each(xmlDoc, "./transf[count(@ord) > 0]") do |el|      
      order = el.attributes["ord"]
      @transfs[order.to_i] = TransfScript.new(el)      
    end
  end
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



10
11
12
# File 'lib/rbeai/TransfLogic.rb', line 10

def default
  @default
end

#destinationsObject

Returns the value of attribute destinations.



10
11
12
# File 'lib/rbeai/TransfLogic.rb', line 10

def destinations
  @destinations
end

Instance Method Details

#transform(file) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/rbeai/TransfLogic.rb', line 27

def transform(file)
  aux = file
  @transfs.each do | trfilter |      
    aux = trfilter.transform(aux) if trfilter != nil      
  end
  return aux
end