Method: DateTime#as_json

Defined in:
lib/json/add/date_time.rb

#as_jsonObject

Returns a hash, that will be turned into a JSON object and represent this object.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/json/add/date_time.rb', line 28

def as_json(*)
  {
    JSON.create_id => self.class.name,
    'y' => year,
    'm' => month,
    'd' => day,
    'H' => hour,
    'M' => min,
    'S' => sec,
    'of' => offset.to_s,
    'sg' => start,
  }
end