Skip to content

Instantly share code, notes, and snippets.

@sycobuny
Created May 3, 2012 02:23
Show Gist options
  • Save sycobuny/2582596 to your computer and use it in GitHub Desktop.
Save sycobuny/2582596 to your computer and use it in GitHub Desktop.
Simple parsing script for Justin
def event(queuename, *nums)
puts "Got event for #{queuename}!"
puts " nums: #{nums.join(', ')}"
end
begin
while line = $stdin.readline
args = line.chomp.split(/\s+/)
1.upto(args.length - 1) { |x| args[x] = args[x].to_i }
if args[1] > (args[-1] - 5)
event(*args)
end
end
rescue EOFError => e
# reached end of processing, time to go away quietly.
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment