module Oddb2xml::TxtExtractorMethods

Public Class Methods

new(str) click to toggle source
# File lib/oddb2xml/extractor.rb, line 11
def initialize(str)
  Oddb2xml.log("TxtExtractorMethods #{str} #{str.to_s.size} bytes")
  @io = StringIO.new(str)
end

Public Instance Methods

to_hash() click to toggle source
# File lib/oddb2xml/extractor.rb, line 16
def to_hash
  data = {}
  while (line = @io.gets)
    next unless /\d{13}/.match?(line)
    ean13 = line.chomp.delete("\"")
    data[ean13] = true
  end
  data
end