Parent

Class/Module Index [+]

Quicksearch

Time

Public Class Methods

json_create(object) click to toggle source
# File lib/json/add/core.rb, line 24
def self.json_create(object)
  if usec = object.delete('u') # used to be tv_usec -> tv_nsec
    object['n'] = usec * 1000
  end
  if respond_to?(:tv_nsec)
    at(*object.values_at('s', 'n'))
  else
    at(object['s'], object['n'] / 1000)
  end
end

Public Instance Methods

to_json(*args) click to toggle source
# File lib/json/add/core.rb, line 35
def to_json(*args)
  {
    JSON.create_id => self.class.name,
    's' => tv_sec,
    'n' => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000
  }.to_json(*args)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.