diff options
author | zzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-09 05:52:43 +0000 |
---|---|---|
committer | zzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-09 05:52:43 +0000 |
commit | 34cbe5ac063457bf58eeec4256f262215eeb57fe (patch) | |
tree | 8080b05e2f51630b6016937c154fc327ffdd5c07 /lib | |
parent | 04e8c4eed7b02929b8fe3091bd794f4d1094c801 (diff) | |
download | ruby-34cbe5ac063457bf58eeec4256f262215eeb57fe.tar.gz |
* lib/rss/rss.rb: [DOC] document Time#w3cdtf by @steveklabnik
[Bug #8821] ありがとうかににく
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rss/rss.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb index 55f7f9c805..6c89598e2d 100644 --- a/lib/rss/rss.rb +++ b/lib/rss/rss.rb @@ -3,6 +3,14 @@ require "time" class Time class << self unless respond_to?(:w3cdtf) + # This method converts a W3CDTF string date/time format to Time object. + # + # The W3CDTF format is defined here: http://www.w3.org/TR/NOTE-datetime + # + # Time.w3cdtf('2003-02-15T13:50:05-05:00') + # # => 2003-02-15 10:50:05 -0800 + # Time.w3cdtf('2003-02-15T13:50:05-05:00').class + # # => Time def w3cdtf(date) if /\A\s* (-?\d+)-(\d\d)-(\d\d) @@ -34,6 +42,13 @@ class Time end unless method_defined?(:w3cdtf) + # This method converts a Time object to a String. The String contains the + # time in W3CDTF date/time format. + # + # The W3CDTF format is defined here: http://www.w3.org/TR/NOTE-datetime + # + # Time.now.w3cdtf + # # => "2013-08-26T14:12:10.817124-07:00" def w3cdtf if usec.zero? fraction_digits = 0 |