Whats wrong with just...
def describe
puts "\
Company : #{name}
Location : #{location}
Web site : #{web_site}
Brief description :
#{description}
"
end
On Tue, 8 Mar 2005, Eric Hodel wrote:
> On 07 Mar 2005, at 06:53, Zev Blut wrote:
>
>> def describe
>> puts "Company : #{name}"
>> puts "Location : #{location}"
>> puts "Web site : #{web_site}"
>> puts "","Brief description :"
>> puts description, ""
>> end
>
> I like this better, much cleaner than puts with ',', which I don't see very
> often. Also, you could pass this array around everywhere, then join the
> whole thing up at the end for printing (so you could, say, HTML format it or
> something).
>
> def describe
> desc = []
> desc << "Company : #{name}"
> desc << "Location : #{location}"
> desc << "Web site : #{web_site}"
> desc << "" << "Brief description :" << description << ""
> puts desc.join('\n')
> end
John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter / tait.co.nz
New Zealand
Refactorers do it a little better every time.