Class: Oddb2xml::MedregbmExtractor
- Defined in:
- lib/oddb2xml/extractor.rb
Instance Attribute Summary
Attributes inherited from Extractor
Instance Method Summary collapse
-
#initialize(str, type) ⇒ MedregbmExtractor
constructor
A new instance of MedregbmExtractor.
- #to_arry ⇒ Object
Methods inherited from Extractor
Constructor Details
#initialize(str, type) ⇒ MedregbmExtractor
Returns a new instance of MedregbmExtractor.
364 365 366 367 |
# File 'lib/oddb2xml/extractor.rb', line 364 def initialize(str, type) @io = StringIO.new(str) @type = type end |
Instance Method Details
#to_arry ⇒ Object
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/oddb2xml/extractor.rb', line 368 def to_arry data = [] case @type when :company while line = @io.gets row = line.chomp.split("\t") next if row[0] =~ /^GLN/ data << { :gln => row[0].to_s.gsub(/[^0-9]/, ''), #=> GLN Betrieb :name_1 => row[1].to_s, #=> Betriebsname 1 :name_2 => row[2].to_s, #=> Betriebsname 2 :address => row[3].to_s, #=> Strasse :number => row[4].to_s, #=> Nummer :post => row[5].to_s, #=> PLZ :place => row[6].to_s, #=> Ort :region => row[7].to_s, #=> Bewilligungskanton :country => row[8].to_s, #=> Land :type => row[9].to_s, #=> Betriebstyp :authorization => row[10].to_s, #=> BTM Berechtigung } end when :person while line = @io.gets row = line.chomp.split("\t") next if row[0] =~ /^GLN/ data << { :gln => row[0].to_s.gsub(/[^0-9]/, ''), #=> GLN Person :last_name => row[1].to_s, #=> Name :first_name => row[2].to_s, #=> Vorname :post => row[3].to_s, #=> PLZ :place => row[4].to_s, #=> Ort :region => row[5].to_s, #=> Bewilligungskanton :country => row[6].to_s, #=> Land :license => row[7].to_s, #=> Bewilligung Selbstdispensation :certificate => row[8].to_s, #=> Diplom :authorization => row[9].to_s, #=> BTM Berechtigung } end end data end |