Method: DateTime#to_json

Defined in:
lib/jinx/json/date.rb

#to_json(*args) ⇒ String

Adds JSON serialization to Ruby Date.

Parameters:

  • args

    the JSON serialization options

Returns:

  • (String)

    the serialized date



15
16
17
18
19
20
# File 'lib/jinx/json/date.rb', line 15

def to_json(*args)
  {
    'json_class' => self.class.name,
    'data' => to_s
  }.to_json(*args)
end