Module: Oddb2xml::TxtExtractorMethods

Included in:
LppvExtractor
Defined in:
lib/oddb2xml/extractor.rb

Instance Method Summary collapse

Instance Method Details

#initialize(str) ⇒ Object



11
12
13
14
# File 'lib/oddb2xml/extractor.rb', line 11

def initialize(str)
  Oddb2xml.log("TxtExtractorMethods #{str} #{str.to_s.size} bytes")
  @io = StringIO.new(str)
end

#to_hashObject



15
16
17
18
19
20
21
22
23
# File 'lib/oddb2xml/extractor.rb', line 15

def to_hash
  data = {}
  while line = @io.gets
    next unless line =~ /\d{13}/
    ean13 = line.chomp.gsub("\"", '')
    data[ean13] = true
  end
  data
end