bitmask_attribute 1.0.2 → 1.0.3
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/.ruby-version +1 -0
- data/CHANGELOG.md +13 -0
- data/README.md +11 -1
- data/bitmask_attribute.gemspec +1 -1
- data/lib/bitmask_attribute/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71a5a9d37f5e7f80765cd4b8a1f04e714c5de998
|
4
|
+
data.tar.gz: 6f59de9498c96accdfa7250f15a6332b081ca53a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f152855cffeed64641b44212aabad816c6b310e67f76faf9cb7298606ba1b078fbf5c25bdd7b172b90d44c9ea31b22353b9b6f4295951f333a4cb095bcf56848
|
7
|
+
data.tar.gz: 049e7b407b227ddee9ee25b0da40d62c2c575e351643857a2c0bc7b3439ead56affa6b96f210afa33ae0a76a3b1ee3a05e636f34cbc3bf8cf66cb39394351299
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -28,9 +28,11 @@ This attribute is expected to be an integer type.
|
|
28
28
|
Class Foo
|
29
29
|
include BitmaskAttribute::Concern
|
30
30
|
|
31
|
+
# Hash of options to bit values
|
32
|
+
OPTIONS_HASH = { option_1: 1, option_2: 2, option_3: 4, option_4: 8 }
|
31
33
|
...
|
32
34
|
|
33
|
-
bitmask_attribute :actions
|
35
|
+
bitmask_attribute :actions, OPTIONS_HASH
|
34
36
|
```
|
35
37
|
|
36
38
|
You now get the following methods at your disposal:
|
@@ -44,6 +46,14 @@ You now get the following methods at your disposal:
|
|
44
46
|
`foo_instance.remove_action(1)`
|
45
47
|
-> removes the input bit flag from the mask
|
46
48
|
|
49
|
+
`foo.option_1 = true`
|
50
|
+
or if using an active record model: `foo.update(option_1: true)`
|
51
|
+
-> adds the 1 bit to the bitmask attribute
|
52
|
+
|
53
|
+
`foo_option_1 = false`
|
54
|
+
or if using an active record model: `foo.update(option_1: false)`
|
55
|
+
-> removes the 1 bit from the bitmask attribute
|
56
|
+
|
47
57
|
## Contributing
|
48
58
|
|
49
59
|
1. Fork it ( https://github.com/[my-github-username]/bitmask_attribute/fork )
|
data/bitmask_attribute.gemspec
CHANGED
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.7"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
-
spec.add_dependency "activesupport", "~>
|
25
|
+
spec.add_dependency "activesupport", "~> 5.0"
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitmask_attribute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Madeline Carson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '5.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '5.0'
|
69
69
|
description: |-
|
70
70
|
Bitmask attribute helper methods for Rails models. Gives model access to methods to
|
71
71
|
check, add, and remove flags.
|
@@ -77,6 +77,8 @@ extra_rdoc_files: []
|
|
77
77
|
files:
|
78
78
|
- ".gitignore"
|
79
79
|
- ".rspec"
|
80
|
+
- ".ruby-version"
|
81
|
+
- CHANGELOG.md
|
80
82
|
- Gemfile
|
81
83
|
- LICENSE.txt
|
82
84
|
- README.md
|
@@ -107,11 +109,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
109
|
version: '0'
|
108
110
|
requirements: []
|
109
111
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.5.1
|
111
113
|
signing_key:
|
112
114
|
specification_version: 4
|
113
115
|
summary: Bitmask attribute helper methods for Rails models.
|
114
116
|
test_files:
|
115
117
|
- spec/bitmask_attribute/concern_spec.rb
|
116
118
|
- spec/spec_helper.rb
|
117
|
-
has_rdoc:
|