Sha256: 532f15d6dd1a1d550e4582876bbebbb3b26738b702064f2fdf7cb06d6e874702
Contents?: true
Size: 716 Bytes
Versions: 30
Compression:
Stored size: 716 Bytes
Contents
#!/usr/bin/env ruby # encoding: UTF-8 %w(lib ext test).each do |dir| $LOAD_PATH.unshift File.expand_path("../../#{dir}", __FILE__) end require 'oj' def create_item(doc) #puts "#{doc.fetch('/id')}: #{doc.fetch('/labels/it/value')} - #{doc.fetch('/descriptions/it/value')}" doc.fetch('/id') doc.fetch('/labels/it/value') doc.fetch('/descriptions/it/value') end 100.times { |i| File.open('dump_10k.json') { |f| f.each { |line| #Oj::Doc.open(line) { |doc| doc = Oj::Doc.open(line) begin create_item(doc) if doc.fetch('/type') == 'item' rescue Exception => e puts "*** #{e.class}: #{e.message}" end doc.close #} } } puts i }
Version data entries
30 entries across 30 versions & 1 rubygems