Sha256: 12529c6bea044884d85924d658d428776852c92b413d9b24033e09610e8cba29

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

module ComixScraper
  
  class Parser

    CATEGORIES = ['DARK HORSE COMICS', 'DC COMICS','IDW PUBLISHING','IMAGE COMICS','MARVEL COMICS','COMICS','MAGAZINES','MERCHANDISE']

    def parse(data)

      release_data = ComixScraper::ReleaseData.new

      current_section = ""
      data.each_with_index { | value, index |

        release_data.categories << value && current_section = value if CATEGORIES.include?value

        values = value.split('\t')
        
        next if values.length != 3
        
        id = values[0]
        title = values[1]
        rrp = values[2]
        release_data.comix << Comic.new(current_section, id, title, rrp)
      }  

      puts "Shipping date: #{data[2].split}"
      release_data.shipping_date = data[2].split[1]
      
      return release_data

    end  
    
    private
    
    def blank? (value)
      false
    end

  end  

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
comix_scraper-1.0.0 lib/comix_scraper/parser.rb
comix_scraper-0.0.3 lib/comix_scraper/parser.rb