act_with_flags 3.1.1 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +14 -0
- data/.github/workflows/rake.yml +2 -6
- data/.ruby-version +1 -1
- data/Gemfile +3 -3
- data/Gemfile.lock +101 -106
- data/MIT-LICENSE +3 -1
- data/README.md +6 -12
- data/act_with_flags.gemspec +0 -3
- data/lib/act_with_flags/version.rb +3 -1
- data/test/any_all_none_test.rb +1 -1
- data/test/benchmark_test.rb +4 -4
- data/test/coding_check_add_test.rb +3 -3
- data/test/coding_coverage_test.rb +1 -1
- data/test/coding_null_test.rb +1 -1
- data/test/coding_one_test.rb +2 -2
- data/test/legacy_test.rb +2 -2
- data/test/null_test.rb +9 -0
- data/test/one_test.rb +8 -2
- data/test/range_test.rb +0 -39
- metadata +4 -35
- data/.watchr +0 -61
- data/gemfiles/rails_6.0.gemfile +0 -15
- data/gemfiles/rails_6.1.gemfile +0 -14
- data/gemfiles/rails_7.0.gemfile +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85f31137d2c12e55c9831fb363e297c245af79cd196a9f1990a8cd1047ba9503
|
4
|
+
data.tar.gz: 9a6e2f01fea005bf6e8677ea15cde979cdd0c10d9c067f47eff4a586015c4b50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 400c97f67d917b0e9416846853122a5008240fe38b8837380af9b9284f09c7c68fade3e754acdd7ce988929c01aad49325502f90b0df3cb9fc05e4cc81774afd
|
7
|
+
data.tar.gz: 3a9a277ca14297b86ec41da731e9b76141fcf69c1950b0d72e34054decedd357b3daa86e9ebfd6ab5b6a67db7af83e2a95350c3c5b8f61bb4b67f4f1fc0ad4da
|
@@ -0,0 +1,14 @@
|
|
1
|
+
name: Lint
|
2
|
+
on: push
|
3
|
+
jobs:
|
4
|
+
lint:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
steps:
|
7
|
+
- name: Checkout code
|
8
|
+
uses: actions/checkout@v3
|
9
|
+
- name: Set up Ruby
|
10
|
+
uses: ruby/setup-ruby@v1
|
11
|
+
with:
|
12
|
+
bundler-cache: true
|
13
|
+
- name: Run Standard
|
14
|
+
run: bundle exec standardrb
|
data/.github/workflows/rake.yml
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# see also https://github.com/whitequark/parser/blob/master/.github/workflows/test.yml
|
2
2
|
name: Rake
|
3
3
|
|
4
|
-
#on: [push, pull_request]
|
5
4
|
on: [push]
|
6
5
|
|
7
6
|
jobs:
|
@@ -9,16 +8,13 @@ jobs:
|
|
9
8
|
strategy:
|
10
9
|
fail-fast: false
|
11
10
|
matrix:
|
12
|
-
# os: [ubuntu-latest, macos-latest]
|
13
11
|
os: [ubuntu-latest]
|
14
|
-
|
15
|
-
# ruby: [2.5, 2.6, 2.7, '3.0', head, jruby, jruby-head, truffleruby, truffleruby-head]
|
16
|
-
ruby: ["2.7.2", "3.0.1", "3.1.2"]
|
12
|
+
ruby: ["2.7", "3.0", "3.2", head]
|
17
13
|
test_command: ["bundle exec rake test"]
|
18
14
|
runs-on: ${{ matrix.os }}
|
19
15
|
|
20
16
|
steps:
|
21
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v3
|
22
18
|
- uses: ruby/setup-ruby@v1
|
23
19
|
with:
|
24
20
|
ruby-version: ${{ matrix.ruby }}
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-3.
|
1
|
+
ruby-3.2.2
|
data/Gemfile
CHANGED
@@ -4,9 +4,9 @@ gemspec
|
|
4
4
|
gem "rails"
|
5
5
|
|
6
6
|
group :test do
|
7
|
-
gem "observr"
|
8
|
-
gem "standardrb", require: false
|
9
|
-
gem "simplecov", require: false
|
10
7
|
gem "benchmark-ips"
|
8
|
+
gem "observr"
|
11
9
|
gem "ricecream"
|
10
|
+
gem "simplecov", require: false
|
11
|
+
gem "standard", require: false
|
12
12
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,72 +1,72 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
act_with_flags (3.1.
|
4
|
+
act_with_flags (3.1.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actioncable (7.0.3
|
10
|
-
actionpack (= 7.0.3
|
11
|
-
activesupport (= 7.0.3
|
9
|
+
actioncable (7.0.4.3)
|
10
|
+
actionpack (= 7.0.4.3)
|
11
|
+
activesupport (= 7.0.4.3)
|
12
12
|
nio4r (~> 2.0)
|
13
13
|
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailbox (7.0.3
|
15
|
-
actionpack (= 7.0.3
|
16
|
-
activejob (= 7.0.3
|
17
|
-
activerecord (= 7.0.3
|
18
|
-
activestorage (= 7.0.3
|
19
|
-
activesupport (= 7.0.3
|
14
|
+
actionmailbox (7.0.4.3)
|
15
|
+
actionpack (= 7.0.4.3)
|
16
|
+
activejob (= 7.0.4.3)
|
17
|
+
activerecord (= 7.0.4.3)
|
18
|
+
activestorage (= 7.0.4.3)
|
19
|
+
activesupport (= 7.0.4.3)
|
20
20
|
mail (>= 2.7.1)
|
21
21
|
net-imap
|
22
22
|
net-pop
|
23
23
|
net-smtp
|
24
|
-
actionmailer (7.0.3
|
25
|
-
actionpack (= 7.0.3
|
26
|
-
actionview (= 7.0.3
|
27
|
-
activejob (= 7.0.3
|
28
|
-
activesupport (= 7.0.3
|
24
|
+
actionmailer (7.0.4.3)
|
25
|
+
actionpack (= 7.0.4.3)
|
26
|
+
actionview (= 7.0.4.3)
|
27
|
+
activejob (= 7.0.4.3)
|
28
|
+
activesupport (= 7.0.4.3)
|
29
29
|
mail (~> 2.5, >= 2.5.4)
|
30
30
|
net-imap
|
31
31
|
net-pop
|
32
32
|
net-smtp
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
|
-
actionpack (7.0.3
|
35
|
-
actionview (= 7.0.3
|
36
|
-
activesupport (= 7.0.3
|
34
|
+
actionpack (7.0.4.3)
|
35
|
+
actionview (= 7.0.4.3)
|
36
|
+
activesupport (= 7.0.4.3)
|
37
37
|
rack (~> 2.0, >= 2.2.0)
|
38
38
|
rack-test (>= 0.6.3)
|
39
39
|
rails-dom-testing (~> 2.0)
|
40
40
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
41
|
-
actiontext (7.0.3
|
42
|
-
actionpack (= 7.0.3
|
43
|
-
activerecord (= 7.0.3
|
44
|
-
activestorage (= 7.0.3
|
45
|
-
activesupport (= 7.0.3
|
41
|
+
actiontext (7.0.4.3)
|
42
|
+
actionpack (= 7.0.4.3)
|
43
|
+
activerecord (= 7.0.4.3)
|
44
|
+
activestorage (= 7.0.4.3)
|
45
|
+
activesupport (= 7.0.4.3)
|
46
46
|
globalid (>= 0.6.0)
|
47
47
|
nokogiri (>= 1.8.5)
|
48
|
-
actionview (7.0.3
|
49
|
-
activesupport (= 7.0.3
|
48
|
+
actionview (7.0.4.3)
|
49
|
+
activesupport (= 7.0.4.3)
|
50
50
|
builder (~> 3.1)
|
51
51
|
erubi (~> 1.4)
|
52
52
|
rails-dom-testing (~> 2.0)
|
53
53
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
54
|
-
activejob (7.0.3
|
55
|
-
activesupport (= 7.0.3
|
54
|
+
activejob (7.0.4.3)
|
55
|
+
activesupport (= 7.0.4.3)
|
56
56
|
globalid (>= 0.3.6)
|
57
|
-
activemodel (7.0.3
|
58
|
-
activesupport (= 7.0.3
|
59
|
-
activerecord (7.0.3
|
60
|
-
activemodel (= 7.0.3
|
61
|
-
activesupport (= 7.0.3
|
62
|
-
activestorage (7.0.3
|
63
|
-
actionpack (= 7.0.3
|
64
|
-
activejob (= 7.0.3
|
65
|
-
activerecord (= 7.0.3
|
66
|
-
activesupport (= 7.0.3
|
57
|
+
activemodel (7.0.4.3)
|
58
|
+
activesupport (= 7.0.4.3)
|
59
|
+
activerecord (7.0.4.3)
|
60
|
+
activemodel (= 7.0.4.3)
|
61
|
+
activesupport (= 7.0.4.3)
|
62
|
+
activestorage (7.0.4.3)
|
63
|
+
actionpack (= 7.0.4.3)
|
64
|
+
activejob (= 7.0.4.3)
|
65
|
+
activerecord (= 7.0.4.3)
|
66
|
+
activesupport (= 7.0.4.3)
|
67
67
|
marcel (~> 1.0)
|
68
68
|
mini_mime (>= 1.1.0)
|
69
|
-
activesupport (7.0.3
|
69
|
+
activesupport (7.0.4.3)
|
70
70
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
71
71
|
i18n (>= 1.6, < 2)
|
72
72
|
minitest (>= 5.1)
|
@@ -76,125 +76,122 @@ GEM
|
|
76
76
|
rake
|
77
77
|
thor (>= 0.14.0)
|
78
78
|
ast (2.4.2)
|
79
|
-
benchmark-ips (2.
|
79
|
+
benchmark-ips (2.12.0)
|
80
80
|
builder (3.2.4)
|
81
81
|
combustion (1.3.7)
|
82
82
|
activesupport (>= 3.0.0)
|
83
83
|
railties (>= 3.0.0)
|
84
84
|
thor (>= 0.14.6)
|
85
|
-
concurrent-ruby (1.
|
85
|
+
concurrent-ruby (1.2.2)
|
86
86
|
crass (1.0.6)
|
87
|
-
|
87
|
+
date (3.3.3)
|
88
88
|
docile (1.4.0)
|
89
|
-
erubi (1.
|
90
|
-
globalid (1.
|
89
|
+
erubi (1.12.0)
|
90
|
+
globalid (1.1.0)
|
91
91
|
activesupport (>= 5.0)
|
92
92
|
i18n (1.12.0)
|
93
93
|
concurrent-ruby (~> 1.0)
|
94
|
-
json (2.6.
|
95
|
-
|
94
|
+
json (2.6.3)
|
95
|
+
language_server-protocol (3.17.0.3)
|
96
|
+
loofah (2.20.0)
|
96
97
|
crass (~> 1.0.2)
|
97
98
|
nokogiri (>= 1.5.9)
|
98
|
-
mail (2.
|
99
|
+
mail (2.8.1)
|
99
100
|
mini_mime (>= 0.1.1)
|
101
|
+
net-imap
|
102
|
+
net-pop
|
103
|
+
net-smtp
|
100
104
|
marcel (1.0.2)
|
101
105
|
method_source (1.0.0)
|
102
106
|
mini_mime (1.1.2)
|
103
|
-
minitest (5.
|
104
|
-
net-imap (0.
|
105
|
-
|
107
|
+
minitest (5.18.0)
|
108
|
+
net-imap (0.3.4)
|
109
|
+
date
|
106
110
|
net-protocol
|
107
|
-
|
108
|
-
net-pop (0.1.1)
|
109
|
-
digest
|
111
|
+
net-pop (0.1.2)
|
110
112
|
net-protocol
|
113
|
+
net-protocol (0.2.1)
|
111
114
|
timeout
|
112
|
-
net-
|
113
|
-
timeout
|
114
|
-
net-smtp (0.3.1)
|
115
|
-
digest
|
115
|
+
net-smtp (0.3.3)
|
116
116
|
net-protocol
|
117
|
-
|
118
|
-
|
119
|
-
nokogiri (1.13.8-x86_64-linux)
|
117
|
+
nio4r (2.5.9)
|
118
|
+
nokogiri (1.14.3-x86_64-linux)
|
120
119
|
racc (~> 1.4)
|
121
120
|
observr (1.0.5)
|
122
121
|
parallel (1.22.1)
|
123
|
-
parser (3.
|
122
|
+
parser (3.2.2.0)
|
124
123
|
ast (~> 2.4.1)
|
125
|
-
racc (1.6.
|
126
|
-
rack (2.2.4)
|
127
|
-
rack-test (2.0
|
124
|
+
racc (1.6.2)
|
125
|
+
rack (2.2.6.4)
|
126
|
+
rack-test (2.1.0)
|
128
127
|
rack (>= 1.3)
|
129
|
-
rails (7.0.3
|
130
|
-
actioncable (= 7.0.3
|
131
|
-
actionmailbox (= 7.0.3
|
132
|
-
actionmailer (= 7.0.3
|
133
|
-
actionpack (= 7.0.3
|
134
|
-
actiontext (= 7.0.3
|
135
|
-
actionview (= 7.0.3
|
136
|
-
activejob (= 7.0.3
|
137
|
-
activemodel (= 7.0.3
|
138
|
-
activerecord (= 7.0.3
|
139
|
-
activestorage (= 7.0.3
|
140
|
-
activesupport (= 7.0.3
|
128
|
+
rails (7.0.4.3)
|
129
|
+
actioncable (= 7.0.4.3)
|
130
|
+
actionmailbox (= 7.0.4.3)
|
131
|
+
actionmailer (= 7.0.4.3)
|
132
|
+
actionpack (= 7.0.4.3)
|
133
|
+
actiontext (= 7.0.4.3)
|
134
|
+
actionview (= 7.0.4.3)
|
135
|
+
activejob (= 7.0.4.3)
|
136
|
+
activemodel (= 7.0.4.3)
|
137
|
+
activerecord (= 7.0.4.3)
|
138
|
+
activestorage (= 7.0.4.3)
|
139
|
+
activesupport (= 7.0.4.3)
|
141
140
|
bundler (>= 1.15.0)
|
142
|
-
railties (= 7.0.3
|
141
|
+
railties (= 7.0.4.3)
|
143
142
|
rails-dom-testing (2.0.3)
|
144
143
|
activesupport (>= 4.2.0)
|
145
144
|
nokogiri (>= 1.6)
|
146
|
-
rails-html-sanitizer (1.
|
147
|
-
loofah (~> 2.
|
148
|
-
railties (7.0.3
|
149
|
-
actionpack (= 7.0.3
|
150
|
-
activesupport (= 7.0.3
|
145
|
+
rails-html-sanitizer (1.5.0)
|
146
|
+
loofah (~> 2.19, >= 2.19.1)
|
147
|
+
railties (7.0.4.3)
|
148
|
+
actionpack (= 7.0.4.3)
|
149
|
+
activesupport (= 7.0.4.3)
|
151
150
|
method_source
|
152
151
|
rake (>= 12.2)
|
153
152
|
thor (~> 1.0)
|
154
153
|
zeitwerk (~> 2.5)
|
155
154
|
rainbow (3.1.1)
|
156
155
|
rake (13.0.6)
|
157
|
-
regexp_parser (2.
|
156
|
+
regexp_parser (2.8.0)
|
158
157
|
rexml (3.2.5)
|
159
158
|
ricecream (0.2.1)
|
160
|
-
rubocop (1.
|
159
|
+
rubocop (1.48.1)
|
161
160
|
json (~> 2.3)
|
162
161
|
parallel (~> 1.10)
|
163
|
-
parser (>= 3.
|
162
|
+
parser (>= 3.2.0.0)
|
164
163
|
rainbow (>= 2.2.2, < 4.0)
|
165
164
|
regexp_parser (>= 1.8, < 3.0)
|
166
165
|
rexml (>= 3.2.5, < 4.0)
|
167
|
-
rubocop-ast (>= 1.
|
166
|
+
rubocop-ast (>= 1.26.0, < 2.0)
|
168
167
|
ruby-progressbar (~> 1.7)
|
169
|
-
unicode-display_width (>=
|
170
|
-
rubocop-ast (1.
|
171
|
-
parser (>= 3.
|
172
|
-
rubocop-performance (1.
|
168
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
169
|
+
rubocop-ast (1.28.0)
|
170
|
+
parser (>= 3.2.1.0)
|
171
|
+
rubocop-performance (1.16.0)
|
173
172
|
rubocop (>= 1.7.0, < 2.0)
|
174
173
|
rubocop-ast (>= 0.4.0)
|
175
|
-
ruby-progressbar (1.
|
176
|
-
simplecov (0.
|
174
|
+
ruby-progressbar (1.13.0)
|
175
|
+
simplecov (0.22.0)
|
177
176
|
docile (~> 1.1)
|
178
177
|
simplecov-html (~> 0.11)
|
179
178
|
simplecov_json_formatter (~> 0.1)
|
180
179
|
simplecov-html (0.12.3)
|
181
180
|
simplecov_json_formatter (0.1.4)
|
182
|
-
sqlite3 (1.
|
183
|
-
standard (1.
|
184
|
-
|
185
|
-
rubocop
|
186
|
-
|
187
|
-
standard
|
188
|
-
strscan (3.0.4)
|
181
|
+
sqlite3 (1.6.2-x86_64-linux)
|
182
|
+
standard (1.26.0)
|
183
|
+
language_server-protocol (~> 3.17.0.2)
|
184
|
+
rubocop (~> 1.48.1)
|
185
|
+
rubocop-performance (~> 1.16.0)
|
189
186
|
thor (1.2.1)
|
190
|
-
timeout (0.3.
|
191
|
-
tzinfo (2.0.
|
187
|
+
timeout (0.3.2)
|
188
|
+
tzinfo (2.0.6)
|
192
189
|
concurrent-ruby (~> 1.0)
|
193
|
-
unicode-display_width (2.2
|
190
|
+
unicode-display_width (2.4.2)
|
194
191
|
websocket-driver (0.7.5)
|
195
192
|
websocket-extensions (>= 0.1.0)
|
196
193
|
websocket-extensions (0.1.5)
|
197
|
-
zeitwerk (2.6.
|
194
|
+
zeitwerk (2.6.7)
|
198
195
|
|
199
196
|
PLATFORMS
|
200
197
|
x86_64-linux
|
@@ -203,16 +200,14 @@ DEPENDENCIES
|
|
203
200
|
act_with_flags!
|
204
201
|
appraisal
|
205
202
|
benchmark-ips
|
206
|
-
bundler
|
207
203
|
combustion
|
208
204
|
minitest
|
209
205
|
observr
|
210
206
|
rails
|
211
|
-
rake
|
212
207
|
ricecream
|
213
208
|
simplecov
|
214
209
|
sqlite3
|
215
|
-
|
210
|
+
standard
|
216
211
|
|
217
212
|
BUNDLED WITH
|
218
|
-
2.
|
213
|
+
2.4.10
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019-2023 Dittmar Krall (www.matiq.com)
|
2
4
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -7,21 +7,14 @@ A Rails gem required by key.matiq.
|
|
7
7
|
Handles booleans in "flags".
|
8
8
|
Defines setters and getters to access the booleans.
|
9
9
|
|
10
|
-
|
11
10
|
## Installation
|
12
11
|
|
13
12
|
As usual:
|
14
13
|
```ruby
|
15
14
|
# Gemfile
|
16
|
-
|
17
|
-
gem 'act_with_flags'
|
15
|
+
gem "act_with_flags"
|
18
16
|
```
|
19
|
-
|
20
|
-
or manually:
|
21
|
-
```shell
|
22
|
-
$ gem install act_with_flags
|
23
|
-
```
|
24
|
-
|
17
|
+
and run "bundle install".
|
25
18
|
|
26
19
|
## Version 3.1.1
|
27
20
|
|
@@ -125,11 +118,12 @@ Further reading:
|
|
125
118
|
- [gem active_flag](https://github.com/kenn/active_flag)
|
126
119
|
- [gem has-bit-field](https://github.com/pjb3/has-bit-field)
|
127
120
|
- [gem bitfield_attribute](https://github.com/gzigzigzeo/bitfield_attribute)
|
121
|
+
- [gem bitwise](https://github.com/kenn/bitwise)
|
128
122
|
|
129
123
|
|
130
|
-
##
|
124
|
+
## Miscellaneous
|
131
125
|
|
132
|
-
Copyright (c) 2019-
|
133
|
-
|
126
|
+
Copyright (c) 2019-2023 Dittmar Krall (www.matiq.com),
|
127
|
+
released under the MIT license:
|
134
128
|
|
135
129
|
* https://opensource.org/licenses/MIT
|
data/act_with_flags.gemspec
CHANGED
@@ -18,11 +18,8 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.files = `git ls-files -z`.split("\x0")
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.add_development_dependency "bundler"
|
22
|
-
s.add_development_dependency "rake"
|
23
21
|
s.add_development_dependency "appraisal"
|
24
22
|
s.add_development_dependency "combustion"
|
25
|
-
|
26
23
|
s.add_development_dependency "minitest"
|
27
24
|
s.add_development_dependency "sqlite3"
|
28
25
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module ActWithFlags
|
4
|
-
VERSION = "3.1.
|
4
|
+
VERSION = "3.1.3" # 2023-04-18
|
5
|
+
# VERSION = "3.1.2" # 2022-12-12
|
6
|
+
# VERSION = "3.1.1" # 2022-09-01
|
5
7
|
# VERSION = "3.1.0" # 2022-08-29
|
6
8
|
# VERSION = "3.0.1" # 2022-08-07
|
7
9
|
# VERSION = "3.0.0" # 2022-07-27
|
data/test/any_all_none_test.rb
CHANGED
data/test/benchmark_test.rb
CHANGED
@@ -6,8 +6,8 @@ require "benchmark"
|
|
6
6
|
require "benchmark/ips"
|
7
7
|
# ENV["MORE"] = "true"
|
8
8
|
|
9
|
-
describe "Internal timings
|
10
|
-
let(:order) { Order.
|
9
|
+
describe "Internal timings" do
|
10
|
+
let(:order) { Order.new }
|
11
11
|
|
12
12
|
def setup
|
13
13
|
reset_order
|
@@ -30,7 +30,7 @@ describe "Internal timings flag" do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "Internal timings mask" do
|
33
|
-
let(:order) { Order.
|
33
|
+
let(:order) { Order.new }
|
34
34
|
let(:admin) { Order.act_with_flags }
|
35
35
|
|
36
36
|
def setup
|
@@ -62,7 +62,7 @@ class BenchFoo < Minitest::Benchmark
|
|
62
62
|
n = 100_000
|
63
63
|
n = 10_000
|
64
64
|
Order.add_to_flags :blocked2
|
65
|
-
order = Order.
|
65
|
+
order = Order.new
|
66
66
|
assert_performance_constant do |input|
|
67
67
|
n.times do
|
68
68
|
order.blocked2 = true
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
|
-
describe "Internal check
|
4
|
-
let(:order) { Order.
|
3
|
+
describe "Internal check add_to_" do
|
4
|
+
let(:order) { Order.new }
|
5
5
|
|
6
6
|
def setup
|
7
7
|
reset_order
|
8
8
|
Order.add_to_flags a: 1, b: 7
|
9
9
|
end
|
10
10
|
|
11
|
-
it "
|
11
|
+
it "skips reserved position" do
|
12
12
|
Order.add_to_flags :xx
|
13
13
|
order.xx = true
|
14
14
|
assert_equal 0x100, order.flags
|
data/test/coding_null_test.rb
CHANGED
data/test/coding_one_test.rb
CHANGED
@@ -10,14 +10,14 @@ describe "Internal One Flag" do
|
|
10
10
|
Order.add_to_flags flag
|
11
11
|
end
|
12
12
|
|
13
|
-
it "test order.
|
13
|
+
it "test order.act_with_" do
|
14
14
|
refute_nil admin
|
15
15
|
assert_equal admin, order.class.act_with_flags
|
16
16
|
assert_equal admin, order.act_with_flags
|
17
17
|
assert_equal admin, Order.act_with_flags
|
18
18
|
end
|
19
19
|
|
20
|
-
it "checks definition of methods
|
20
|
+
it "checks definition of methods" do
|
21
21
|
msg = "method '#{flag}' not defined"
|
22
22
|
assert order.respond_to?(flag.to_s), msg
|
23
23
|
assert order.respond_to?("#{flag}?"), msg
|
data/test/legacy_test.rb
CHANGED
data/test/null_test.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
describe "No Flags" do
|
4
|
+
let(:order) { Order.new }
|
5
|
+
|
4
6
|
def setup
|
5
7
|
reset_order
|
6
8
|
Order.add_to_flags
|
@@ -12,4 +14,11 @@ describe "No Flags" do
|
|
12
14
|
assert Order.respond_to?(:clear_flags_at_save)
|
13
15
|
assert Order.respond_to?(:act_with_flags)
|
14
16
|
end
|
17
|
+
|
18
|
+
it "checks mask et all; no parameters" do
|
19
|
+
assert_equal 0, order.flags_mask
|
20
|
+
refute order.flags_any?
|
21
|
+
assert order.flags_all?
|
22
|
+
assert order.flags_none?
|
23
|
+
end
|
15
24
|
end
|
data/test/one_test.rb
CHANGED
@@ -2,14 +2,20 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
describe "One Flag" do
|
4
4
|
let(:flag) { :blocked }
|
5
|
-
let(:order) { Order.
|
5
|
+
let(:order) { Order.new }
|
6
6
|
|
7
7
|
def setup
|
8
8
|
reset_order
|
9
9
|
Order.add_to_flags flag
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "checks defaults" do
|
13
|
+
refute_equal true, order.blocked
|
14
|
+
assert_equal false, order.blocked
|
15
|
+
assert_equal false, order.blocked?
|
16
|
+
end
|
17
|
+
|
18
|
+
it "set :blocked" do
|
13
19
|
order.blocked = true
|
14
20
|
assert_equal true, order.blocked
|
15
21
|
assert_equal true, order.blocked?
|
data/test/range_test.rb
CHANGED
@@ -47,43 +47,4 @@ describe "range" do
|
|
47
47
|
it "tests range ...0 no position" do
|
48
48
|
assert_raises(RangeError) { Order.add_to_flags :a, range: ...0 }
|
49
49
|
end
|
50
|
-
|
51
|
-
# YAGNI
|
52
|
-
# # includes range: ( .. 3 ) equivalent to range: ..3
|
53
|
-
# n = 100
|
54
|
-
# (0..n).each do |i|
|
55
|
-
# rng = ..i
|
56
|
-
#
|
57
|
-
# (0..i).each do |j|
|
58
|
-
# it "tests range ..#{i} with position #{j}" do
|
59
|
-
# Order.add_to_flags a: j, range: rng
|
60
|
-
# end
|
61
|
-
# end
|
62
|
-
#
|
63
|
-
# it "fails range ..#{i} with position overflow" do
|
64
|
-
# assert_raises(RangeError) { Order.add_to_flags b: (i + 1), range: rng }
|
65
|
-
# end
|
66
|
-
# end
|
67
|
-
#
|
68
|
-
# it "runs ii plus" do
|
69
|
-
# ii = 0
|
70
|
-
# (0..2).each { |íí|
|
71
|
-
# sym = "x#{ii}".to_sym
|
72
|
-
# j = f(ii, ii + 1) # filler
|
73
|
-
# rand j
|
74
|
-
# Order.add_to_flags :range => ii..f(íí, íí), sym => (ii += 1)
|
75
|
-
# orden = Order.new
|
76
|
-
# refute orden.send("#{sym}?") # checks that accessor is active
|
77
|
-
# orden.x0 = true # checks that first accessor is still there
|
78
|
-
# assert orden.x0?
|
79
|
-
# }
|
80
|
-
# end
|
81
|
-
#
|
82
|
-
# private
|
83
|
-
#
|
84
|
-
# def f(x, y)
|
85
|
-
# return y + 1 if x == 0
|
86
|
-
# return f(x - 1, 1) if y == 0
|
87
|
-
# f(x - 1, f(x, y - 1))
|
88
|
-
# end
|
89
50
|
end
|
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: act_with_flags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: appraisal
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,11 +73,11 @@ executables: []
|
|
101
73
|
extensions: []
|
102
74
|
extra_rdoc_files: []
|
103
75
|
files:
|
76
|
+
- ".github/workflows/lint.yml"
|
104
77
|
- ".github/workflows/rake.yml"
|
105
78
|
- ".gitignore"
|
106
79
|
- ".ruby-gemset"
|
107
80
|
- ".ruby-version"
|
108
|
-
- ".watchr"
|
109
81
|
- Appraisals
|
110
82
|
- Gemfile
|
111
83
|
- Gemfile.lock
|
@@ -113,9 +85,6 @@ files:
|
|
113
85
|
- README.md
|
114
86
|
- Rakefile
|
115
87
|
- act_with_flags.gemspec
|
116
|
-
- gemfiles/rails_6.0.gemfile
|
117
|
-
- gemfiles/rails_6.1.gemfile
|
118
|
-
- gemfiles/rails_7.0.gemfile
|
119
88
|
- lib/act_with_flags.rb
|
120
89
|
- lib/act_with_flags/admin.rb
|
121
90
|
- lib/act_with_flags/clear.rb
|
@@ -177,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
146
|
- !ruby/object:Gem::Version
|
178
147
|
version: '0'
|
179
148
|
requirements: []
|
180
|
-
rubygems_version: 3.
|
149
|
+
rubygems_version: 3.4.10
|
181
150
|
signing_key:
|
182
151
|
specification_version: 4
|
183
152
|
summary: act_with_flags gem
|
data/.watchr
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
TESTING = %w[test]
|
2
|
-
HH = "#" * 22 unless defined?(HH)
|
3
|
-
H = "#" * 5 unless defined?(H)
|
4
|
-
|
5
|
-
def usage
|
6
|
-
puts <<-EOS
|
7
|
-
Ctrl-\\ or ctrl-4 Running all tests
|
8
|
-
Ctrl-C Exit
|
9
|
-
EOS
|
10
|
-
end
|
11
|
-
|
12
|
-
def run(cmd)
|
13
|
-
puts "#{HH} #{Time.now} #{HH}"
|
14
|
-
puts "#{H} #{cmd}"
|
15
|
-
system "/usr/bin/time --format '#{HH} Elapsed time %E' #{cmd}"
|
16
|
-
end
|
17
|
-
|
18
|
-
def run_it(type, files)
|
19
|
-
files.split(" ").flatten.each do |file|
|
20
|
-
case type
|
21
|
-
when "test" then run %(bundle exec ruby -I test #{file})
|
22
|
-
# when 'spec'; run %(rspec -X #{file})
|
23
|
-
else; puts "#{H} unknown type: #{type}, file: #{file}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def run_all_tests
|
29
|
-
puts "\n#{HH} Running all tests #{HH}\n"
|
30
|
-
TESTING.each { |dir| run "bundle exec rake #{dir}" if File.exist?(dir) }
|
31
|
-
end
|
32
|
-
|
33
|
-
def run_matching_files(base)
|
34
|
-
base = base.split("_").first
|
35
|
-
TESTING.each { |type|
|
36
|
-
files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*\.rb/ }
|
37
|
-
run_it type, files.join(" ") unless files.empty?
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
TESTING.each { |type|
|
42
|
-
watch("#{type}/#{type}_helper\.rb") { run_all_tests }
|
43
|
-
watch("lib/.*\.rb") { run_all_tests }
|
44
|
-
watch("#{type}/.*/*_#{type}\.rb") { |match| run_it type, match[0] }
|
45
|
-
watch("#{type}/data/(.*)\.rb") { |match|
|
46
|
-
m1 = match[1]
|
47
|
-
run_matching_files("#{type}/#{m1}/#{m1}_#{type}.rb")
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
%w[rb erb haml slim].each { |type|
|
52
|
-
watch("app/.*/(.*)\.#{type}") { |match|
|
53
|
-
run_matching_files(match[1])
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
# Ctrl-\ or ctrl-4
|
58
|
-
Signal.trap("QUIT") { run_all_tests }
|
59
|
-
# Ctrl-C
|
60
|
-
Signal.trap("INT") { abort("Interrupted\n") }
|
61
|
-
usage
|
data/gemfiles/rails_6.0.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "~> 6.0.0"
|
6
|
-
|
7
|
-
group :test do
|
8
|
-
gem "observr"
|
9
|
-
gem "rubocop", require: false
|
10
|
-
gem "simplecov", require: false
|
11
|
-
gem "benchmark-ips", require: false
|
12
|
-
gem "ricecream", require: false
|
13
|
-
end
|
14
|
-
|
15
|
-
gemspec path: "../"
|
data/gemfiles/rails_6.1.gemfile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "~> 6.0"
|
6
|
-
|
7
|
-
group :test do
|
8
|
-
gem "observr"
|
9
|
-
gem "rubocop", require: false
|
10
|
-
gem "simplecov", require: false
|
11
|
-
gem "benchmark-ips"
|
12
|
-
end
|
13
|
-
|
14
|
-
gemspec path: "../"
|
data/gemfiles/rails_7.0.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "~> 7.0"
|
6
|
-
|
7
|
-
group :test do
|
8
|
-
gem "observr"
|
9
|
-
gem "rubocop", require: false
|
10
|
-
gem "simplecov", require: false
|
11
|
-
gem "benchmark-ips", require: false
|
12
|
-
gem "ricecream", require: false
|
13
|
-
end
|
14
|
-
|
15
|
-
gemspec path: "../"
|