Maybe 

```ruby
state = {'0' => 'ok', '1' => 'warning', '2' => 'critical'}[state.downcase] || 'unknown'
```

?