flag_shih_tzu 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.coveralls.yml +1 -0
- data/CHANGELOG +10 -1
- data/README.rdoc +26 -16
- data/flag_shih_tzu.gemspec +1 -1
- data/lib/flag_shih_tzu.rb +1 -1
- data/lib/flag_shih_tzu/version.rb +1 -1
- metadata +53 -19
- checksums.yaml +0 -7
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
Version 0.3.8 - NOV.24.2013
|
2
|
+
* Improved Readme / Documentation by Peter Boling
|
3
|
+
* Added Badges by Peter Boling
|
4
|
+
* Configured Coveralls by Peter Boling
|
5
|
+
* Added Code Climate, Coveralls, Gemnasium, and Version Badges by Peter Boling
|
6
|
+
|
7
|
+
Version 0.3.7 - OCT.25.2013
|
8
|
+
* Change `sql_in_for_flag` to consider values from the range [0, 2 * max - 1] by Blake Thomson
|
9
|
+
|
1
10
|
Version 0.3.6 - AUG.29.2013
|
2
11
|
* Allow use with any gem manager by Peter Boling
|
3
12
|
* No need to alter Ruby's load path by Peter Boling
|
@@ -6,7 +15,7 @@ Version 0.3.5 - AUG.06.2013
|
|
6
15
|
* Fix Travis Build & Add Rails 4 by Peter M. Goldstein
|
7
16
|
* Implemented update_flag! by Peter Boling (see https://github.com/pboling/flag_shih_tzu/issues/27)
|
8
17
|
- sets a flag on a record without triggering callbacks or validations
|
9
|
-
- optionally syncs the instance with new flag value
|
18
|
+
- optionally syncs the instance with new flag value, by default it does not.
|
10
19
|
* Update gemspec by Peter Boling
|
11
20
|
|
12
21
|
Version 0.3.4 - JUN.20.2013
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=FlagShihTzu {<img src="https://secure.travis-ci.org/pboling/flag_shih_tzu.png" />}[http://travis-ci.org/pboling/flag_shih_tzu] {<img src="http://api.coderwall.com/pboling/endorsecount.png" />}[http://coderwall.com/pboling]
|
1
|
+
=FlagShihTzu {<img src="https://badge.fury.io/rb/flag_shih_tzu.png" alt="Gem Version" />}[http://badge.fury.io/rb/flag_shih_tzu] {<img src="https://secure.travis-ci.org/pboling/flag_shih_tzu.png" />}[http://travis-ci.org/pboling/flag_shih_tzu] {<img src="https://codeclimate.com/github/pboling/flag_shih_tzu.png" />}[https://codeclimate.com/github/pboling/flag_shih_tzu] {<img src="https://coveralls.io/repos/pboling/flag_shih_tzu/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/pboling/flag_shih_tzu] {<img src="https://gemnasium.com/pboling/flag_shih_tzu.png" alt="Dependency Status" />}[https://gemnasium.com/pboling/flag_shih_tzu] {<img src="http://api.coderwall.com/pboling/endorsecount.png" />}[http://coderwall.com/pboling]
|
2
2
|
|
3
3
|
Bit fields for ActiveRecord
|
4
4
|
|
@@ -38,7 +38,7 @@ More information on the changes for 0.3.X: {pboling/flag_shih_tzu/wiki/Changes-f
|
|
38
38
|
|
39
39
|
Travis CI: {<img src="https://secure.travis-ci.org/pboling/flag_shih_tzu.png" />}[http://travis-ci.org/pboling/flag_shih_tzu]
|
40
40
|
|
41
|
-
CodeClimate: https://codeclimate.com/github/pboling/flag_shih_tzu
|
41
|
+
CodeClimate: {<img src="https://codeclimate.com/github/pboling/flag_shih_tzu.png" />}[https://codeclimate.com/github/pboling/flag_shih_tzu]
|
42
42
|
|
43
43
|
==Prerequisites
|
44
44
|
|
@@ -92,7 +92,7 @@ false).
|
|
92
92
|
|
93
93
|
+has_flags+ takes a hash. The keys must be positive integers and represent
|
94
94
|
the position of the bit being used to enable or disable the flag.
|
95
|
-
<b>The keys must not be changed once in use, or you will get
|
95
|
+
<b>The keys must not be changed once in use, or you will get incorrect results.</b>
|
96
96
|
That is why the plugin forces you to set them explicitly.
|
97
97
|
The values are symbols for the flags being created.
|
98
98
|
|
@@ -152,7 +152,7 @@ different columns for separate flags:
|
|
152
152
|
:column => 'crew'
|
153
153
|
|
154
154
|
|
155
|
-
===Generated instance methods
|
155
|
+
===Generated boolean patterned instance methods
|
156
156
|
|
157
157
|
Calling +has_flags+ as shown above creates the following instance methods
|
158
158
|
on Spaceship:
|
@@ -190,6 +190,23 @@ on Spaceship:
|
|
190
190
|
Spaceship#selected_electrolytes=
|
191
191
|
Spaceship#has_electrolyte?
|
192
192
|
|
193
|
+
Optionally, you can set the <tt>:bang_methods</tt> option to true to enable the bang methods:
|
194
|
+
|
195
|
+
Spaceship#electrolytes! # will save the bitwise equivalent of electrolytes = true on the record
|
196
|
+
Spaceship#not_electrolytes! # will save the bitwise equivalent of electrolytes = false on the record
|
197
|
+
|
198
|
+
which respectively enables or disables the electrolytes flag.
|
199
|
+
|
200
|
+
The <tt>:bang_methods</tt> does not save the records to the database, meaning it cannot engage validations and callbacks.
|
201
|
+
|
202
|
+
Alternatively, if you do want to <b>save a flag</b> to the database, while still avoiding validations and callbacks, use <tt>update_flag!</tt> which:
|
203
|
+
|
204
|
+
* sets a flag on a database record without triggering callbacks or validations
|
205
|
+
* optionally syncs the ruby instance with new flag value, by default it does not.
|
206
|
+
|
207
|
+
update_flag!(flag_name, flag_value, update_instance = false)
|
208
|
+
|
209
|
+
|
193
210
|
===Generated class methods
|
194
211
|
|
195
212
|
Calling +has_flags+ as shown above creates the following class methods
|
@@ -197,13 +214,6 @@ on Spaceship:
|
|
197
214
|
|
198
215
|
Spaceship.flag_columns # [:features, :crew]
|
199
216
|
|
200
|
-
Optionally, you can set the <tt>:bang_methods</tt> option to true to enable the bang methods:
|
201
|
-
|
202
|
-
Spaceship#electrolytes!
|
203
|
-
Spaceship#not_electrolytes!
|
204
|
-
|
205
|
-
which respectively enables or disables the electrolytes flag.
|
206
|
-
|
207
217
|
|
208
218
|
===Generated named scopes
|
209
219
|
|
@@ -384,14 +394,14 @@ Find out more about XING
|
|
384
394
|
== Versioning
|
385
395
|
|
386
396
|
This library aims to adhere to {Semantic Versioning 2.0.0}[http://semver.org/].
|
387
|
-
Violations of this scheme should be reported as bugs. Specifically,
|
388
|
-
if a minor or patch version is released that breaks backward
|
397
|
+
Violations of this scheme should be reported as bugs. Specifically,
|
398
|
+
if a minor or patch version is released that breaks backward
|
389
399
|
compatibility, a new version should be immediately released that
|
390
|
-
restores compatibility. Breaking changes to the public API will
|
400
|
+
restores compatibility. Breaking changes to the public API will
|
391
401
|
only be introduced with new major versions.
|
392
402
|
|
393
|
-
As a result of this policy, you can (and should) specify a
|
394
|
-
dependency on this gem using the {Pessimistic Version Constraint}[http://docs.rubygems.org/read/chapter/16#page74] with two digits of precision.
|
403
|
+
As a result of this policy, you can (and should) specify a
|
404
|
+
dependency on this gem using the {Pessimistic Version Constraint}[http://docs.rubygems.org/read/chapter/16#page74] with two digits of precision.
|
395
405
|
|
396
406
|
For example:
|
397
407
|
|
data/flag_shih_tzu.gemspec
CHANGED
@@ -28,6 +28,6 @@ ActiveRecord object.
|
|
28
28
|
s.add_development_dependency "bundler"
|
29
29
|
s.add_development_dependency "rdoc", ">= 2.4.2"
|
30
30
|
s.add_development_dependency "rake"
|
31
|
-
|
31
|
+
s.add_development_dependency "coveralls"
|
32
32
|
s.add_development_dependency "sqlite3"
|
33
33
|
end
|
data/lib/flag_shih_tzu.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flag_shih_tzu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Peter Boling
|
@@ -12,90 +13,122 @@ authors:
|
|
12
13
|
autorequire:
|
13
14
|
bindir: bin
|
14
15
|
cert_chain: []
|
15
|
-
date: 2013-
|
16
|
+
date: 2013-11-24 00:00:00.000000000 Z
|
16
17
|
dependencies:
|
17
18
|
- !ruby/object:Gem::Dependency
|
18
19
|
name: activerecord
|
19
20
|
requirement: !ruby/object:Gem::Requirement
|
21
|
+
none: false
|
20
22
|
requirements:
|
21
|
-
- - '>='
|
23
|
+
- - ! '>='
|
22
24
|
- !ruby/object:Gem::Version
|
23
25
|
version: 2.3.0
|
24
26
|
type: :runtime
|
25
27
|
prerelease: false
|
26
28
|
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
27
30
|
requirements:
|
28
|
-
- - '>='
|
31
|
+
- - ! '>='
|
29
32
|
- !ruby/object:Gem::Version
|
30
33
|
version: 2.3.0
|
31
34
|
- !ruby/object:Gem::Dependency
|
32
35
|
name: bundler
|
33
36
|
requirement: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
34
38
|
requirements:
|
35
|
-
- - '>='
|
39
|
+
- - ! '>='
|
36
40
|
- !ruby/object:Gem::Version
|
37
41
|
version: '0'
|
38
42
|
type: :development
|
39
43
|
prerelease: false
|
40
44
|
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
41
46
|
requirements:
|
42
|
-
- - '>='
|
47
|
+
- - ! '>='
|
43
48
|
- !ruby/object:Gem::Version
|
44
49
|
version: '0'
|
45
50
|
- !ruby/object:Gem::Dependency
|
46
51
|
name: rdoc
|
47
52
|
requirement: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
48
54
|
requirements:
|
49
|
-
- - '>='
|
55
|
+
- - ! '>='
|
50
56
|
- !ruby/object:Gem::Version
|
51
57
|
version: 2.4.2
|
52
58
|
type: :development
|
53
59
|
prerelease: false
|
54
60
|
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
55
62
|
requirements:
|
56
|
-
- - '>='
|
63
|
+
- - ! '>='
|
57
64
|
- !ruby/object:Gem::Version
|
58
65
|
version: 2.4.2
|
59
66
|
- !ruby/object:Gem::Dependency
|
60
67
|
name: rake
|
61
68
|
requirement: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
62
70
|
requirements:
|
63
|
-
- - '>='
|
71
|
+
- - ! '>='
|
64
72
|
- !ruby/object:Gem::Version
|
65
73
|
version: '0'
|
66
74
|
type: :development
|
67
75
|
prerelease: false
|
68
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
69
78
|
requirements:
|
70
|
-
- - '>='
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: coveralls
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
71
96
|
- !ruby/object:Gem::Version
|
72
97
|
version: '0'
|
73
98
|
- !ruby/object:Gem::Dependency
|
74
99
|
name: sqlite3
|
75
100
|
requirement: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
76
102
|
requirements:
|
77
|
-
- - '>='
|
103
|
+
- - ! '>='
|
78
104
|
- !ruby/object:Gem::Version
|
79
105
|
version: '0'
|
80
106
|
type: :development
|
81
107
|
prerelease: false
|
82
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
83
110
|
requirements:
|
84
|
-
- - '>='
|
111
|
+
- - ! '>='
|
85
112
|
- !ruby/object:Gem::Version
|
86
113
|
version: '0'
|
87
|
-
description:
|
88
|
-
|
114
|
+
description: ! 'Bit fields for ActiveRecord:
|
115
|
+
|
89
116
|
This gem lets you use a single integer column in an ActiveRecord model
|
117
|
+
|
90
118
|
to store a collection of boolean attributes (flags). Each flag can be used
|
119
|
+
|
91
120
|
almost in the same way you would use any boolean attribute on an
|
121
|
+
|
92
122
|
ActiveRecord object.
|
123
|
+
|
124
|
+
'
|
93
125
|
email: peter.boling@gmail.com
|
94
126
|
executables: []
|
95
127
|
extensions: []
|
96
128
|
extra_rdoc_files: []
|
97
129
|
files:
|
98
130
|
- .DS_Store
|
131
|
+
- .coveralls.yml
|
99
132
|
- .gitignore
|
100
133
|
- .travis.yml
|
101
134
|
- CHANGELOG
|
@@ -118,26 +151,27 @@ files:
|
|
118
151
|
homepage: https://github.com/pboling/flag_shih_tzu
|
119
152
|
licenses:
|
120
153
|
- MIT
|
121
|
-
metadata: {}
|
122
154
|
post_install_message:
|
123
155
|
rdoc_options: []
|
124
156
|
require_paths:
|
125
157
|
- lib
|
126
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
127
160
|
requirements:
|
128
|
-
- - '>='
|
161
|
+
- - ! '>='
|
129
162
|
- !ruby/object:Gem::Version
|
130
163
|
version: '0'
|
131
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
none: false
|
132
166
|
requirements:
|
133
|
-
- - '>='
|
167
|
+
- - ! '>='
|
134
168
|
- !ruby/object:Gem::Version
|
135
169
|
version: '0'
|
136
170
|
requirements: []
|
137
171
|
rubyforge_project:
|
138
|
-
rubygems_version:
|
172
|
+
rubygems_version: 1.8.25
|
139
173
|
signing_key:
|
140
|
-
specification_version:
|
174
|
+
specification_version: 3
|
141
175
|
summary: Bit fields for ActiveRecord
|
142
176
|
test_files:
|
143
177
|
- test/database.yml
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 3c9ecb9654411ac0213bcc2e6c0942dcc12142c1
|
4
|
-
data.tar.gz: 29cb7d8958165e9fb98929e71a658ed8fdbf338b
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 28d35a352d8668e8bdcf8c0d1397b1c5052ae3262aaddc01d85f8f51e650fdee25c4d5928411d85bac44be4267e9619f36fa3369a309ce230641049681527657
|
7
|
-
data.tar.gz: ee18826fd3dabd765164a8dbfeeb36bab661d62bcbecc6615a297f5b5dd7cb751bca7c9744276105c344ac8cd1d4ab8dbb43b00fc00d3fba5d46ca6e784ad7fa
|