Skip to content

Instantly share code, notes, and snippets.

@bananarne
Created June 26, 2018 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bananarne/57c1301f9ea0377c2d29af2476267958 to your computer and use it in GitHub Desktop.
Save bananarne/57c1301f9ea0377c2d29af2476267958 to your computer and use it in GitHub Desktop.
timestamp_conversion = proc do |k,v|
new_k = k == "timestampMs" ? Time.at(k[1..-4]) : k
new_v = case v
when Array
v.map do |e|
case e
when Hash
e.map(&:timestamp_conversion)
else
e
end
end
when Hash
v.map(&:timestamp_conversion)
else
v
end
[new_k,new_v]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment