[Ruby] unless block on one line
ben wiseley
wiseleyb at gmail.com
Fri Jan 26 06:36:47 PST 2007
this_row[:print_date] = row.at(7).date unless row.at(7).nil?
On 1/26/07, shaners becker <veganstraightedge at gmail.com> wrote:
>
> is there a way of expressing this on one line?
>
> unless row.at(7).nil?
> this_row[:print_date] = row.at(7).date
> end
>
> i thought it would be
>
> unless row.at(7).nil? this_row[:print_date] = row.at(7).date end
>
> or maybe
>
> unless row.at(7).nil? {this_row[:print_date] = row.at(7).date}
>
> i always hear/see people being uber succinct in ruby and i get stuck
> on these blocks that feel like they could probably be on one line.
>
> thanks
> shaners
>
> -----------
> join the resistance. fall in love.
> http://theresistancearmy.com/
>
>
> _______________________________________________
> Ruby at zenspider.com - Seattle.rb non-commercial list
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
>
More information about the Ruby
mailing list