Sha256: da4aed1d4f90ef6d625d56cae211f65b19eb15c53529df29f579e260eca80826

Contents?: true

Size: 366 Bytes

Versions: 2

Compression:

Stored size: 366 Bytes

Contents

class Sysdig::Model
  def self.epoch_time(v, options={})
    divisor = options[:divisor] || 1_000

    case v
    when Time then v
    when Numeric then Time.at(v / divisor)
    else nil
    end
  end

  def self.microsecond_datetime(v, *)
    i = v.to_i

    i > 1_000_000 ? i / 1_000_000 : i
  end

  def self.upcase(v, *)
    v.nil? ? v : v.to_s.upcase
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sysdig-0.3.1 lib/sysdig/model.rb
sysdig-0.3.0 lib/sysdig/model.rb