oddb2tdat 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/oddb2tdat.rb +16 -5
- metadata +4 -4
data/History.txt
CHANGED
data/lib/oddb2tdat.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
-
# Oddb2tdat --
|
3
|
+
# Oddb2tdat -- 12.01.2012 -- mhatakeyama@ywesee.com
|
4
4
|
|
5
5
|
=begin
|
6
6
|
01 RECA Recordart 001 – 002 2 alpha: 11
|
@@ -21,7 +21,7 @@
|
|
21
21
|
=end
|
22
22
|
|
23
23
|
class Oddb2tdat
|
24
|
-
VERSION = '1.0.
|
24
|
+
VERSION = '1.0.3'
|
25
25
|
COL = {
|
26
26
|
:CMUT => 30, # AE
|
27
27
|
:PHAR => 6, # G
|
@@ -63,6 +63,9 @@ class Oddb2tdat
|
|
63
63
|
File.open(@input, 'r:iso-8859-1:utf-8') do |input|
|
64
64
|
while line=input.gets
|
65
65
|
row = ''
|
66
|
+
prpu = ''
|
67
|
+
pre = ''
|
68
|
+
las = ''
|
66
69
|
cols = line.split(/;/)
|
67
70
|
if cmut = cols[COL[:CMUT]] and cmut =~ /Ja/ or cmut =~ /Nein/
|
68
71
|
row << "%#{LEN[:RECA]}s" % '11'
|
@@ -71,7 +74,11 @@ class Oddb2tdat
|
|
71
74
|
row << "%-#{LEN[:ABEZ]}s" % (cols[COL[:ABEZ]].to_s + " " + cols[COL[:PACK]]).to_s[0,LEN[:ABEZ]]
|
72
75
|
row << "%0#{LEN[:PRMO]}d" % 0
|
73
76
|
prpu = cols[COL[:PRPU]].to_s.split('.')
|
74
|
-
pre = "%04d" %
|
77
|
+
pre = "%04d" % if prpu[0]
|
78
|
+
prpu[0]
|
79
|
+
else
|
80
|
+
0
|
81
|
+
end
|
75
82
|
las = if prpu[1]
|
76
83
|
if prpu[1].size < 2
|
77
84
|
prpu[1] + "0"*(2-prpu.last.size)
|
@@ -82,7 +89,7 @@ class Oddb2tdat
|
|
82
89
|
'00'
|
83
90
|
end
|
84
91
|
prpu = pre.to_s + las.to_s
|
85
|
-
row << "%#{LEN[:PRPU]}s" % prpu
|
92
|
+
row << "%#{LEN[:PRPU]}s" % prpu[0,LEN[:PRPU]]
|
86
93
|
row << "%#{LEN[:CKZL]}s" % if cols[COL[:CKZL1]] =~ /Ja/
|
87
94
|
1
|
88
95
|
elsif cols[COL[:CKZL2]] =~ /Ja/
|
@@ -92,7 +99,11 @@ class Oddb2tdat
|
|
92
99
|
end
|
93
100
|
row << "%#{LEN[:CLAG]}s" % 0
|
94
101
|
row << "%#{LEN[:CBGG]}s" % (cols[COL[:CBGG]] =~ /Ja/ ? 1:0)
|
95
|
-
row << "%#{LEN[:CIKS]}s" % cols[COL[:CIKS]]
|
102
|
+
row << "%#{LEN[:CIKS]}s" % if ciks = cols[COL[:CIKS]] and ciks != '""'
|
103
|
+
ciks
|
104
|
+
else
|
105
|
+
0
|
106
|
+
end
|
96
107
|
row << "%0#{LEN[:ITHE]}d" % cols[COL[:ITHE]].gsub('.','').to_i
|
97
108
|
row << "%#{LEN[:CEAN]}s" % cols[COL[:CEAN]]
|
98
109
|
@rows << row
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oddb2tdat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Masaomi Hatakeyama, Zeno R.R. Davatz
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-12 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|