Class DateTime
In: lib/json/add/core.rb
Parent: Object
Regexp Struct Time Date Exception Range DateTime Symbol\n[lib/json/add/core.rb\nlib/json/add/rails.rb] dot/f_1.png

Methods

External Aliases

sg -> start

Public Class methods

[Source]

    # File lib/json/add/core.rb, line 63
63:   def self.json_create(object)
64:     args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
65:     of_a, of_b = object['of'].split('/')
66:     if of_b and of_b != '0'
67:       args << Rational(of_a.to_i, of_b.to_i)
68:     else
69:       args << of_a
70:     end
71:     args << object['sg']
72:     civil(*args)
73:   end

Public Instance methods

[Source]

    # File lib/json/add/core.rb, line 77
77:   def to_json(*args)
78:     {
79:       JSON.create_id => self.class.name,
80:       'y' => year,
81:       'm' => month,
82:       'd' => day,
83:       'H' => hour,
84:       'M' => min,
85:       'S' => sec,
86:       'of' => offset.to_s,
87:       'sg' => start,
88:     }.to_json(*args)
89:   end

[Validate]