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

Version Path
ix-cli-0.0.27 bin/ix-replay
ix-cli-0.0.26 bin/ix-replay
ix-cli-0.0.25 bin/ix-replay
ix-cli-0.0.24 bin/ix-replay
ix-cli-0.0.23 bin/ix-replay
ix-cli-0.0.22 bin/ix-replay
ix-cli-0.0.21 bin/ix-replay
ix-cli-0.0.20 bin/ix-replay
ix-cli-0.0.19 bin/ix-replay
ix-cli-0.0.18 bin/ix-replay
ix-cli-0.0.17 bin/ix-replay
ix-cli-0.0.16 bin/ix-replay
ix-cli-0.0.15 bin/ix-replay
ix-cli-0.0.14 bin/ix-replay
ix-cli-0.0.13 bin/ix-replay
ix-cli-0.0.12 bin/ix-replay
ix-cli-0.0.11 bin/ix-replay
ix-cli-0.0.10 bin/ix-replay
ix-cli-0.0.9 bin/ix-replay
ix-cli-0.0.7 bin/ix-replay