Permalink
Browse files

Reapply 28303cc

  • Loading branch information...
1 parent 48b8bff commit d20d2bf491d62a2a72adc3e5df07e497ee379590 Erik Hollensbe committed May 4, 2011
Showing with 16 additions and 6 deletions.
  1. +16 −6 lib/rubygems/commands/query_command.rb
@@ -241,13 +241,12 @@ def output_query_results(spec_tuples)
if matching_tuples.length == 1 then
loaded_from = File.dirname File.dirname(spec.loaded_from)
entry << "\n" << " Installed at: #{loaded_from}"
+ entry << "\n" << " Created: #{spec.date.strftime("%Y-%m-%d")}"
else
- label = 'Installed at'
- matching_tuples.each do |(_,version,_,s),|
- loaded_from = File.dirname File.dirname(s.loaded_from)
- entry << "\n" << " #{label} (#{version}): #{loaded_from}"
- label = ' ' * label.length
- end
+ entry << format_multi_label('Installed at', matching_tuples) do |spec|
+ File.dirname File.dirname(spec.loaded_from)
+ end
+ entry << format_multi_label('Created', matching_tuples) { |s| s.date.strftime("%Y-%m-%d") }
end
end
@@ -259,5 +258,16 @@ def output_query_results(spec_tuples)
say output.join(options[:details] ? "\n\n" : "\n")
end
+ def format_multi_label(label, matching_tuples)
+ entry = ""
+
+ matching_tuples.each do |(_,version,_,s),|
+ target = yield s
+ entry << "\n" << " #{label} (#{version}): #{target}"
+ label = ' ' * label.length
+ end
+
+ return entry
+ end
end

0 comments on commit d20d2bf

Please sign in to comment.