Class DateTime
In: lib/json/add/core.rb
Parent: Object
Range Date Time Exception Regexp Struct DateTime dot/f_6.png

Methods

External Aliases

sg -> start

Public Class methods

[Source]

    # File lib/json/add/core.rb, line 53
53:   def self.json_create(object)
54:     args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
55:     of_a, of_b = object['of'].split('/')
56:     if of_b and of_b != '0'
57:       args << Rational(of_a.to_i, of_b.to_i)
58:     else
59:       args << of_a
60:     end
61:     args << object['sg']
62:     civil(*args)
63:   end

Public Instance methods

[Source]

    # File lib/json/add/core.rb, line 67
67:   def to_json(*args)
68:     {
69:       'json_class' => self.class.name,
70:       'y' => year,
71:       'm' => month,
72:       'd' => day,
73:       'H' => hour,
74:       'M' => min,
75:       'S' => sec,
76:       'of' => offset.to_s,
77:       'sg' => start,
78:     }.to_json(*args)
79:   end

[Validate]