<p>i have a basic ruby class:</p>

<pre><code>class LogEntry

end
</code></pre>

<p>and what i would like to do is be able to define a hash with a few values like so:</p>

<pre><code>EntryType = { :error =&gt; 0, :warning =&gt; 1, :info =&gt; 2 }
</code></pre>

<p>so that i can access the values like this (or something similar):</p>

<pre><code>LogEntry.EntryType[:error]
</code></pre>

<p>is this even possible in Ruby? am i going about this the right way?</p>

You can do this:
```
```
class LogEntry
    EntryType = { :error => 0, :warning => 1, :info => 2 }
end
```
```
But you want to reference it as
```
```
LogEntry::EntryType[:error]
```
```