oddb2tdat 1.1.1 → 1.1.2

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 +4 -0
  2. data/lib/oddb2tdat.rb +13 -8
  3. metadata +4 -4
@@ -1,3 +1,7 @@
1
+ === 1.1.2 / 17.08.2012
2
+
3
+ * Added rows counts for reporting
4
+
1
5
  === 1.1.1 / 23.04.2012
2
6
 
3
7
  * Updated MiGel swissmedic-listencode as blank space
@@ -1,6 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # Oddb2tdat -- 23.04.2012 -- yasaka@ywesee.com
3
+ # Oddb2tdat -- 17.08.2012 -- yasaka@ywesee.com
4
4
  # Oddb2tdat -- 15.02.2012 -- mhatakeyama@ywesee.com
5
5
 
6
6
  require 'date'
@@ -25,7 +25,7 @@ require 'date'
25
25
  =end
26
26
 
27
27
  class Oddb2tdat
28
- VERSION = '1.1.1'
28
+ VERSION = '1.1.2'
29
29
  COL = {
30
30
  :ODDB => {
31
31
  :CMUT => 30, # AE
@@ -66,13 +66,13 @@ class Oddb2tdat
66
66
  :CMWS => 1,
67
67
  }
68
68
  POS = {
69
- :PHAR => 3,
69
+ :PHAR => 3,
70
70
  :PRMO => 60,
71
71
  :PRPU => 66,
72
72
  :CEAN => 83,
73
73
  }
74
74
  attr_accessor :target, :transfer
75
- attr_reader :updated_prmo
75
+ attr_reader :updated_prmo, :counts
76
76
  def initialize(input, output, *options)
77
77
  @target = [:oddb]
78
78
  @transfer = false
@@ -80,6 +80,11 @@ class Oddb2tdat
80
80
  @input = input
81
81
  @output = output
82
82
  @options = options
83
+ @counts = { # for report
84
+ :oddb => 0,
85
+ :migel => 0,
86
+ :prmo => 0,
87
+ }
83
88
  end
84
89
  def run
85
90
  parse
@@ -163,6 +168,7 @@ class Oddb2tdat
163
168
  end
164
169
  end
165
170
  end
171
+ @counts[:oddb] = @rows.length
166
172
  end
167
173
  def parse_migel
168
174
  return if @rows.empty?
@@ -196,6 +202,7 @@ class Oddb2tdat
196
202
  end
197
203
  end
198
204
  end
205
+ @counts[:migel] = (@rows.length - @counts[:oddb])
199
206
  end
200
207
  def import_prmo
201
208
  import_ean = {}
@@ -204,7 +211,6 @@ class Oddb2tdat
204
211
  import_ean.store(line[POS[:CEAN], LEN[:CEAN]], line.chomp)
205
212
  import_pha.store(line[POS[:PHAR], LEN[:PHAR]], line.chomp)
206
213
  end
207
-
208
214
  @rows = []
209
215
  @updated_prmo = 0
210
216
  File.readlines(@input).each do |line|
@@ -220,8 +226,8 @@ class Oddb2tdat
220
226
  end
221
227
  @rows << row
222
228
  end
223
-
224
- output
229
+ @counts[:prmo] = @rows.length
230
+ output
225
231
  end
226
232
  def output
227
233
  open(@output, "w") do |out|
@@ -230,5 +236,4 @@ class Oddb2tdat
230
236
  end
231
237
  end
232
238
  end
233
-
234
239
  end
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: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 1
10
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
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-04-23 00:00:00 Z
18
+ date: 2012-08-17 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rdoc