bitfield_flags 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -2
- data/lib/bitfield_flags/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aed4be5b9a0324c485226d8e00cd4ae94510aa5b
|
4
|
+
data.tar.gz: 5c752b14bca5268ec03effa621a7a1b923fe58b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c49b7eef7cfd603d126af4be177f57eaee60ae8f1ccb9873d4b3028cacd3d556223a848bc95adea056bbdd2cd9c8054b1d032eb4c65676acb5463fb6afb5f65a
|
7
|
+
data.tar.gz: 7dc926a8d4e1643d1fa95857e40caafafd1fffb496567e57bb675548933b05e05bed62019f01fc87c78ab18215c4d5ed19443ed13c6e2237d2579fa52ef9d4fd
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# BitfieldFlags
|
2
2
|
|
3
|
-
|
3
|
+
Quickly add bitfield scopes to an active record model
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,24 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
```ruby
|
22
|
+
class User < ActiveRecord::Base
|
23
|
+
include BitfieldFlags
|
24
|
+
|
25
|
+
scoped_flags %w(
|
26
|
+
is_admin
|
27
|
+
is_customer_service
|
28
|
+
legacy_user
|
29
|
+
)
|
30
|
+
|
31
|
+
# ...snip...
|
32
|
+
end
|
33
|
+
|
34
|
+
User.is_admin #=> Returns all users with the 'is_admin' bitfield turned on
|
35
|
+
|
36
|
+
user = User.first
|
37
|
+
user.is_admin? #=> true or false depending on the is_admin bitfield state
|
38
|
+
```
|
22
39
|
|
23
40
|
## Contributing
|
24
41
|
|