Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module AutoTimestamp
- def query_callback(rows, options)
- rows.each do |r|
- r.each do |k, v|
- if v.is_a?(Integer)
- dates = [ Time.at(v), Time.at(v / 1000) ]
- plausible_date = dates.find { |d|
- d >= Time.now - 10.years && d <= Time.now + 10.years
- }
- if plausible_date
- r[k] = "#{plausible_date.localtime('-07:00').to_s} (#{v})"
- end
- end
- end
- end
- end
- end
- Hirb::Helpers::Table.send :include, AutoTimestamp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement