Sha256: 38ddd55607dc00c5da864d8a6a453849fb9e51b462681cd41ba54aeff0a6a4ed

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

module Tracebin
  module Helpers
    def to_milliseconds(time)
      time.to_f * 1000
    end

    def time_to_string(time)
      time.is_a?(String) ? time : time.iso8601(6)
    end

    def timestamp_string
      Time.now.iso8601 6
    end

    def deserialize_time_string(str)
      Time.parse str
    end

    def milliseconds_between(time1, time2)
      time1 = deserialize_time_string(time1) if time1.is_a?(String)
      time2 = deserialize_time_string(time2) if time2.is_a?(String)

      to_milliseconds(time1 - time2).abs
    end
  end
end

module Tracebin
  class PatchHelper
    class << self
      include ::Tracebin::Helpers
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tracebin-0.0.12 lib/tracebin/helpers.rb
tracebin-0.0.11 lib/tracebin/helpers.rb