diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-05 10:35:30 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-05 10:35:30 +0000 |
commit | 23863ff75d3ec9205d5f365b98b6608e38a93749 (patch) | |
tree | 362b9fc870edb3820ef488a6618baf5669d3aa48 /lib/rdoc/parser/changelog.rb | |
parent | 0d715e1b7540e1c876a4c53862355d5c43dd8683 (diff) |
* lib/rdoc/*, test/rdoc/*: Update rdoc/rdoc master(f191513)
https://github.com/rdoc/rdoc/blob/master/History.rdoc#423--2016--
https://github.com/rdoc/rdoc/blob/master/History.rdoc#422--2016-02-09
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/parser/changelog.rb')
-rw-r--r-- | lib/rdoc/parser/changelog.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb index 92c8d94ad6..c6c2d2bb23 100644 --- a/lib/rdoc/parser/changelog.rb +++ b/lib/rdoc/parser/changelog.rb @@ -102,9 +102,11 @@ class RDoc::Parser::ChangeLog < RDoc::Parser # Groups +entries+ by date. def group_entries entries + @time_cache ||= {} entries.group_by do |title, _| begin - Time.parse(title).strftime '%Y-%m-%d' + time = @time_cache[title] + (time || Time.parse(title)).strftime '%Y-%m-%d' rescue NoMethodError, ArgumentError time, = title.split ' ', 2 Time.parse(time).strftime '%Y-%m-%d' @@ -128,6 +130,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser # 'README.EXT.ja: ditto']] def parse_entries + @time_cache ||= {} entries = [] entry_name = nil entry_body = [] @@ -143,6 +146,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser begin time = Time.parse entry_name + @time_cache[entry_name] = time # HACK Ruby 1.8 does not raise ArgumentError for Time.parse "Other" entry_name = nil unless entry_name =~ /#{time.year}/ rescue NoMethodError @@ -185,6 +189,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser # Converts the ChangeLog into an RDoc::Markup::Document def scan + @time_cache = {} entries = parse_entries grouped_entries = group_entries entries |