Class: Date

Inherits:
Object show all
Defined in:
lib/json/add/core.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.json_create(object) ⇒ Object



45
46
47
# File 'lib/json/add/core.rb', line 45

def self.json_create(object)
  civil(*object.values_at('y', 'm', 'd', 'sg'))
end

Instance Method Details

#to_json(*args) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/json/add/core.rb', line 51

def to_json(*args)
  {
    JSON.create_id => self.class.name,
    'y' => year,
    'm' => month,
    'd' => day,
    'sg' => start,
  }.to_json(*args)
end