From 23863ff75d3ec9205d5f365b98b6608e38a93749 Mon Sep 17 00:00:00 2001 From: hsbt Date: Mon, 5 Sep 2016 10:35:30 +0000 Subject: * 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 --- lib/rdoc/parser/changelog.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/rdoc/parser/changelog.rb') 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 -- cgit v1.2.3