[Rubygems-developers] PATCH: normalize summary specification into one line

Chad Fowler 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
> summary:
>
>   s.summary = <<-EOF
>     A Ruby implementation of the DICT protocol (RFC 2229) for using 
> online
>     dictionaries.  It includes an application 'rdict' for looking up 
> words
>     from the command-line.
>   EOF
>
> 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. :)

Chad



More information about the Rubygems-developers mailing list