Monthly Archives: February 2010

Ruby on Rails – Code Escape

A quick Ruby tip for breaking up a long line of code:

def app_state
if self.title_id != nil and self.title_id != '' \
and self.given_names != nil and self.given_names != ''\
and self.surname != nil and self.surname != '';
return true
else
return false
end
end

Use \ at the break point of each line and ; at the end of the last line.