Class: RbEAI::AwkScript

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

Direct Known Subclasses

Csv2XmlScript, Xml2CsvScript

Instance Method Summary collapse

Methods inherited from Script

#transform

Constructor Details

#initialize(node) ⇒ AwkScript

Returns a new instance of AwkScript.



96
97
98
99
# File 'lib/rbeai/TransfLogic.rb', line 96

def initialize(node)
  super(node)
  @separator = (sep = node.attributes["separator"])!= nil ? "-F "+sep : ""      
end

Instance Method Details

#doTransform(file, newfilename) ⇒ Object



101
102
103
104
# File 'lib/rbeai/TransfLogic.rb', line 101

def doTransform(file, newfilename)
  print "gawk -f #{@script} #{@separator} #{@file} > #{newfilename} \n"
  result = system("gawk -f #{@script} #{@separator} #{file} > #{newfilename}")
end