Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
def beds(c) beds = [] if c.double_bedrooms > 0 beds << pluralize(c.double_bedrooms, 'double') end if c.twin_bedrooms > 0 beds << pluralize(c.twin_bedrooms, 'twin') end if c.single_bedrooms > 0 beds << pluralize(c.single_bedrooms, 'single') end beds.each_with_index do |b,i| if i < beds.size-2 beds[i] = "#{b}, " elsif i == beds.size-1 beds[i] = " and #{b}." end end beds end
This paste will be private.
From the Design Piracy series on my blog: