brainspec/enumerize — pull request #109 by CyborgMaster (2013-09-24 05:28:48+00:00)
Title: Shortcut methods to retrieve value and text of enum

Define shortcut methods to retrieve the value and text of an enum from the class (as opposed to an instance)

With the following class definition:
``` ruby
class Client < ActiveRecord::Base
extend Enumerize
enumerize :status, in: {inactive: 0, active: 1}
end
```

You can retrieve the values of the enum by calling:
``` ruby
Client.status.find_value(:active).value #=> 1
```
but this is clunky and overly verbose, especially when trying to put together a sql query, etc.

This adds two new methods to the attribute for each value:
``` ruby
Client.status.active #=> 1
Client.status.active_text #=> 'Active'
```

These are inline with the spirit of the methods available to instances and allow for more concise retrieval of enum values.

Let me know if you have any questions or there is anything you would like me to change.