oddb2tdat 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/History.txt +6 -1
  2. data/lib/oddb2tdat.rb +9 -6
  3. metadata +40 -64
data/History.txt CHANGED
@@ -1,4 +1,9 @@
1
- === 1.0.4 / 13.01.2012
1
+ === 1.0.6 / 15.02.2012
2
+
3
+ * RECA becomes always 11, added CMWS with 2 at the end of line, and output
4
+ * file is saved with iso-8859-1.
5
+
6
+ === 1.0.5 / 13.01.2012
2
7
 
3
8
  * Added readable instance variable @updated_prmo
4
9
  * This fix will ad more PRMO prices for doctors if we have the price.
data/lib/oddb2tdat.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Oddb2tdat -- 20.01.2012 -- mhatakeyama@ywesee.com
3
+ # Oddb2tdat -- 15.02.2012 -- mhatakeyama@ywesee.com
4
4
 
5
5
  require 'date'
6
6
  =begin
@@ -18,11 +18,12 @@ require 'date'
18
18
  09 CBGG Betäubung - Gift 075 – 075 1 num: (AI)
19
19
  10 CIKS Swissmedic-Listencode 076 – 076 1 alpha: (P)
20
20
  11 ITHE Index-Therapeutikus 077 – 083 7 num: (AH)
21
- 12 CEAN EAN-Code 084 – 096: (E)
21
+ 12 CEAN EAN-Code 084 – 096: 13 num (E)
22
+ 13 CMWS Mehrwertsteuer-Code 097 - 097 1 num: 2
22
23
  =end
23
24
 
24
25
  class Oddb2tdat
25
- VERSION = '1.0.5'
26
+ VERSION = '1.0.6'
26
27
  COL = {
27
28
  :CMUT => 30, # AE
28
29
  :PHAR => 6, # G
@@ -51,6 +52,7 @@ class Oddb2tdat
51
52
  :CIKS => 1,
52
53
  :ITHE => 7,
53
54
  :CEAN => 13,
55
+ :CMWS => 1,
54
56
  }
55
57
  POS = {
56
58
  :PHAR => 3,
@@ -105,12 +107,12 @@ class Oddb2tdat
105
107
  end
106
108
  def parse
107
109
  @rows = []
108
- File.open(@input, 'r:iso-8859-1:utf-8') do |input|
110
+ File.open(@input, 'r:iso-8859-1') do |input|
109
111
  while line=input.gets
110
112
  row = ''
111
113
  cols = line.split(/;/)
112
114
  if cmut = cols[COL[:CMUT]] and cmut =~ /Ja/ or cmut =~ /Nein/
113
- row << "%#{LEN[:RECA]}s" % '01'
115
+ row << "%#{LEN[:RECA]}s" % '11'
114
116
  row << "%#{LEN[:CMUT]}s" % if(phar = cols[COL[:PHAR]] and phar.size > 3) or (!expired?(cols[COL[:GULT]]))
115
117
  (cmut =~ /Ja/ ? '3':'1')
116
118
  else
@@ -136,6 +138,7 @@ class Oddb2tdat
136
138
  end
137
139
  row << "%#{LEN[:ITHE]}s" % format_date(cols[COL[:ITHE]])
138
140
  row << "%#{LEN[:CEAN]}s" % cols[COL[:CEAN]]
141
+ row << "%#{LEN[:CMWS]}s" % '2'
139
142
  @rows << row
140
143
  end
141
144
  end
@@ -169,7 +172,7 @@ class Oddb2tdat
169
172
  output
170
173
  end
171
174
  def output
172
- open(@output, "w") do |out|
175
+ open(@output, "w:iso-8859-1") do |out|
173
176
  @rows.each do |line|
174
177
  out.print line, "\n"
175
178
  end
metadata CHANGED
@@ -1,66 +1,51 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: oddb2tdat
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.6
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 5
10
- version: 1.0.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Masaomi Hatakeyama, Zeno R.R. Davatz
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-20 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rdoc
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &20470800 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 19
29
- segments:
30
- - 3
31
- - 10
32
- version: "3.10"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.10'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: hoe
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *20470800
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ requirement: &20468840 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
29
+ requirements:
41
30
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 27
44
- segments:
45
- - 2
46
- - 12
47
- version: "2.12"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.13'
48
33
  type: :development
49
- version_requirements: *id002
50
- description: |-
51
- * oddb2tdat converts oddb.csv to oddb.dat
52
- * http://dev.ywesee.com/wiki.php/ODDB/Oddb2tdat
53
- email:
34
+ prerelease: false
35
+ version_requirements: *20468840
36
+ description: ! '* oddb2tdat converts oddb.csv to oddb.dat
37
+
38
+ * http://dev.ywesee.com/wiki.php/ODDB/Oddb2tdat'
39
+ email:
54
40
  - mhatakeyama@ywesee.com, zdavatz@ywesee.com
55
- executables:
41
+ executables:
56
42
  - oddb2tdat
57
43
  extensions: []
58
-
59
- extra_rdoc_files:
44
+ extra_rdoc_files:
60
45
  - History.txt
61
46
  - Manifest.txt
62
47
  - README.txt
63
- files:
48
+ files:
64
49
  - History.txt
65
50
  - Manifest.txt
66
51
  - README.txt
@@ -69,37 +54,28 @@ files:
69
54
  - lib/oddb2tdat.rb
70
55
  homepage: http://scm.ywesee.com/?p=oddb2tdat/.git;a=summary
71
56
  licenses: []
72
-
73
57
  post_install_message:
74
- rdoc_options:
58
+ rdoc_options:
75
59
  - --main
76
60
  - README.txt
77
- require_paths:
61
+ require_paths:
78
62
  - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
63
+ required_ruby_version: !ruby/object:Gem::Requirement
80
64
  none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
88
- required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
70
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
97
75
  requirements: []
98
-
99
76
  rubyforge_project: oddb2tdat
100
77
  rubygems_version: 1.8.15
101
78
  signing_key:
102
79
  specification_version: 3
103
- summary: "* oddb2tdat converts oddb.csv to oddb.dat * http://dev.ywesee.com/wiki.php/ODDB/Oddb2tdat"
80
+ summary: ! '* oddb2tdat converts oddb.csv to oddb.dat * http://dev.ywesee.com/wiki.php/ODDB/Oddb2tdat'
104
81
  test_files: []
105
-