I find myself doing something like this a lot lately:

# where result is most often the textual output of a %x{command}
(c = result.match(/id: (\d+)/)) ? c.captures.first : result.scan(/error:
(.*)/).to_s

Is there a smoother/better way to say this?

-- 
Posted via http://www.ruby-forum.com/.