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

Methods

External Aliases

sg -> start

Public Class methods

[Source]

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

Public Instance methods

[Source]

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

[Validate]