Module: CopybookUtils

Extended by:
CONVERT_METHODS
Defined in:
lib/copybook_utils.rb,
lib/copybook_utils/version.rb,
lib/copybook_utils/convert_file.rb

Defined Under Namespace

Classes: ConvertFile

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Methods included from CONVERT_METHODS

ascii2ebcdic, ebcdic2ascii

Class Method Details

.copybook_to_xml(copybook_filename) ⇒ Object



11
12
13
14
15
16
# File 'lib/copybook_utils.rb', line 11

def copybook_to_xml copybook_filename
    path = File.expand_path(File.dirname(__FILE__))
    cmd = "java -jar #{path}/cb2xml-0.95.1/cb2xml.jar #{copybook_filename}"
    stdout, stderr, status = Open3.capture3(cmd)
    { :xml => stdout, :error_out => stderr, :process_status => status }
end

.to_ascii(copybook_xml, from_filename, to_filename) ⇒ Object



18
19
20
21
# File 'lib/copybook_utils.rb', line 18

def to_ascii copybook_xml, from_filename, to_filename
    converter = CopybookUtils::ConvertFile.new
    converter.convert_file method(:ebcdic2ascii), copybook_xml, from_filename, to_filename
end

.to_ebcdic(copybook_xml, from_filename, to_filename) ⇒ Object



23
24
25
26
# File 'lib/copybook_utils.rb', line 23

def to_ebcdic copybook_xml, from_filename, to_filename
    converter = CopybookUtils::ConvertFile.new
    converter.convert_file method(:ascii2ebcdic), copybook_xml, from_filename, to_filename
end