[Rubygems-developers] PATCH: normalize summary specification into
chad at chadfowler.com
Sat Apr 17 09:16:36 EDT 2004
On 17/4/2004, at 12:52 AM, Gavin Sinclair wrote:
> When creating a gemspec for ruby-dict, this is how I defined the
> s.summary = <<-EOF
> A Ruby implementation of the DICT protocol (RFC 2229) for using
> dictionaries. It includes an application 'rdict' for looking up
> from the command-line.
> There's an implicit assumption when they are displayed that summaries
> are one line. So I modified specification.rb to accept multi-line
> summaries and normalize them into one line.
> + ##
> + # Sets the summary of the Specification, but normalizes the
> formatting into one line.
> + #
> + # summary:: [String] The summary text
> + #
> + def summary=(summary)
> + @summary = summary.strip.gsub(/(\w-)\n\s*(\w)/,
> '\1\2').gsub(/\n\s*/, " ")
> + end
> I think this is a reasonable thing to do, but others may disagree, so
> I've posted the patch here instead of committing it. Notice that the
> first gsub is to handle hyphenated words with a newline in the middle.
> Thoughts? Complete patch below so you can try it if you wish.
> If you guys like the idea, I'll put more effort into implementation,
> and also cover the "description" field, before committing.
I think it's a good idea. I would call it a bug fix. :)
More information about the Rubygems-developers