Sha256: b17774e4930f82d22673f1c78137ea92acc1a143fc32fcd7b0e2af2b5bbeb131

Contents?: true

Size: 372 Bytes

Versions: 11

Compression:

Stored size: 372 Bytes

Contents

class Date
  def to_json(*a)
    %("#{to_s(:json)}")
  end
  
  def to_s_with_json(*args)
    if args[0] == :json
      strftime("%Y/%m/%d")
    else
      to_s_without_json *args
    end
  end
  alias_method :to_s_without_json, :to_s
  alias_method :to_s, :to_s_with_json
  
  
  def self.json_create string
    return nil if string.nil?
    Date.parse(string)
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
couch_potato-0.3.2 lib/core_ext/date.rb
couch_potato-0.3.1 lib/core_ext/date.rb
davber_couch_potato-0.3.0 lib/core_ext/date.rb
couch_potato-0.3.0 lib/core_ext/date.rb
couch_potato-0.2.32 lib/core_ext/date.rb
couch_potato-0.2.31 lib/core_ext/date.rb
couch_potato-0.2.30 lib/core_ext/date.rb
couch_potato-0.2.29 lib/core_ext/date.rb
couch_potato-0.2.28 lib/core_ext/date.rb
couch_potato-0.2.27 lib/core_ext/date.rb
couch_potato-0.2.26 lib/core_ext/date.rb