> Consider a class that supports a number of configurable properties.

> [snip all but my favourite one]

> 4. YieldSelf
>
> I've seen some people include a "yield self" in the initialize() method,
> which allows you to do something like this:
>
>     class Link
>         attr_accessor :url, :content, ...   # this line was missing
>         def initialize(url, content)
>           @url = url
>           @content = content
>           yield self if block_given?
>         end
>     end
>
>     link = Link.new(url, "here") { |l|
>         l.title = "the whole story"
>     }

> Where am I going to with this?  No idea.  I guess I'm just wondering
> what y'all consider to be the benefits/problems of each approach.

I like that approach because it's clean, it's explicit, it's
self-documenting (just look at which attributes are writable, and each
attribute can be RDoc'ed), and the resulting code is attractive:
lower-level configuration code is indented.

It's easier to read than the hash approach, while taking a similar amount
of typing.

The only downside is that it requires you to set *accessors* instead of
the more restrictive *readers*.

I've actually written an article on this topic.  Without having read it (I
haven't e-published it yet), you summarised it very well!

Cheers,
Gavin