Parsing an array in Ruby

  code => '
    timestamps = Array.new
    event.get("timestamp").each_with_index { |x, i| timestamps.push(Time.at(x.to_i / 1000)) }
    event.set( "IsThisOK" , timestamps)
  '

Does that put the right data into IsThisOK? You don't really need with_index at this point, and there are lots of other ways to do the init and push for the array, but I think it works.

2 Likes