Class: Date

Inherits:
Object
  • Object
show all
Defined in:
lib/couch_potato/core_ext/date.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.json_create(string) ⇒ Object



10
11
12
13
# File 'lib/couch_potato/core_ext/date.rb', line 10

def self.json_create string
  return nil if string.nil?
  Date.parse(string)
end

Instance Method Details

#as_json(*args) ⇒ Object



6
7
8
# File 'lib/couch_potato/core_ext/date.rb', line 6

def as_json(*args)
  strftime("%Y/%m/%d")
end

#to_json(*a) ⇒ Object



2
3
4
# File 'lib/couch_potato/core_ext/date.rb', line 2

def to_json(*a)
  %("#{as_json}")
end