-
Notifications
You must be signed in to change notification settings - Fork 0
Treat an attribute as a bitmask
License
capnregex/attribute_bitmask
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
AttributeBitmask ================ Attribute Bitmask is designed to allow you to create accessor methods to access bitmask fields as if they were boolean attributes in the model. Example ======= Simply declare an existing integer column as a bitmask with its possible values. class User < ActiveRecord::Base bitmask :roles, :writer, :publisher, :editor, :proofreader end You can then access the bitmask fields as if they were boolean columns. user = User.create(:name => "Bruce", :publisher => true, :editor => true) user.publisher? # => true user.writer? # => false user.writer = true user.writer # => true user.writer? # => true user.roles # => 7 Copyright (c) 2010 [Robert Ferney], released under the MIT license
About
Treat an attribute as a bitmask
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published