Sha256: 9fd749a6f48cbbd5735e5cec79ef02c5f82e4e2579eede1a4133cc833a5f4057
Contents?: true
Size: 538 Bytes
Versions: 26
Compression:
Stored size: 538 Bytes
Contents
#!/usr/bin/env ruby STDOUT.sync = true require 'json' target_key = ARGV[0] || 'timestamp' previous_time = nil STDIN.each_line do |line| begin object = JSON.parse(line) unless previous_time puts line.chomp if object.keys.include?(target_key) previous_time = object[target_key] end next end if object.keys.include?(target_key) sleep object[target_key] - previous_time puts line.chomp end previous_time = object[target_key] rescue => error next end end
Version data entries
26 entries across 26 versions & 1 rubygems