Object
DateTime serialization/deserialization
Deserializes JSON string by converting year y, month m, day d, hour H, minute M, second S, offset of and Day of Calendar Reform sg to DateTime.
# File lib/json/add/date_time.rb, line 12 12: def self.json_create(object) 13: args = object.values_at('y', 'm', 'd', 'H', 'M', 'S') 14: of_a, of_b = object['of'].split('/') 15: if of_b and of_b != '0' 16: args << Rational(of_a.to_i, of_b.to_i) 17: else 18: args << of_a 19: end 20: args << object['sg'] 21: civil(*args) 22: end
Returns a hash, that will be turned into a JSON object and represent this object.
# File lib/json/add/date_time.rb, line 28 28: def as_json(*) 29: { 30: JSON.create_id => self.class.name, 31: 'y' => year, 32: 'm' => month, 33: 'd' => day, 34: 'H' => hour, 35: 'M' => min, 36: 'S' => sec, 37: 'of' => offset.to_s, 38: 'sg' => start, 39: } 40: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.