Ruby returns the result of assigns. So you can simply do: `if match = ACTION_REGEXP.match(@name)`