Sha256: a2e9e11218dd28a647f7a51cb5883de4db3f4106f7cf7979219776bccd14d099

Contents?: true

Size: 431 Bytes

Versions: 30

Compression:

Stored size: 431 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)
  item_id = doc['source']
  # ...
  puts item_id
end

File.open('log.json') { |f|
  Oj::load(f, mode: :compat) { |doc|
    begin
      create_item(doc) if doc['msgType'] == 1
    rescue Exception => e
      puts "*** #{e.class}: #{e.message}"
    end
  }
}

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
oj-3.7.6 test/bug_load.rb
oj-2.18.5 test/bug_load.rb
oj-2.18.4 test/bug_load.rb
oj-2.18.3 test/bug_load.rb
oj-2.18.2 test/bug_load.rb
oj-2.18.1 test/bug_load.rb
oj-2.18.0 test/bug_load.rb
oj-2.17.5 test/bug_load.rb
oj-2.17.3 test/bug_load.rb
oj-2.17.2 test/bug_load.rb
oj-2.17.1 test/bug_load.rb
oj-2.17.0 test/bug_load.rb
oj-2.16.1 test/bug_load.rb
oj-2.14.6 test/bug_load.rb
oj-2.14.5 test/bug_load.rb
oj-2.14.4 test/bug_load.rb
oj-2.14.3 test/bug_load.rb
oj-2.14.2 test/bug_load.rb
oj-2.14.1 test/bug_load.rb
oj-2.14.0 test/bug_load.rb