On Nov 29, 2007, at 11:25 AM, slothbear wrote:
> I'm still learning Ruby, and most of the time I can find a beautiful
> Ruby idiom that collapses two or more statements into one easy-to-read
> (or learn) idiom, like h[key] ||= 0. My current project has a lot of
> places where it emits lists if they contain any items, much like this:
>
> unless items.empty?
> puts "items\n-----"
> items.each { |item| puts item }
> end
puts "items",
"-----",
items unless items.empty?
I don't guess that's much better.
It does feel like it should be a separate method to me.
James Edward Gray II