From: nephish Date: 2006-11-12T00:10:05+09:00 Subject: Re: can i shorten up this function ? Pe�a wrote: > :fr nephish [mailto:nephish@gmail.com] > # def get_in_list(status) > # my_list = 'x,j,m,jrn,fnk,foo,other' > # my_list_array = my_list.split(',') > > a candidate for chaining methods > > # if my_list_array.include?(status) > # return true > # else > # return false > # end > > you are repeating and paraphrasing my_list_array.include?(status). lose the returns, lose the ifs. this is ruby. r u a c programmer? ;-) > > nonetheless, this is again a candidate for chaining. > > # end > # > # i dunno, just thought there might be a prettier way to do this. > > if you get a solution within a minute, including the typing, then that's pretty :) > > kind regards -botp > > > # any suggestions ? > # thanks > # > # > # not a c programmer, just a newbie appreciate everyones help, me stuff looks a lot better now. -sk