act_with_flags 0.2.3 → 3.1.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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +30 -0
  3. data/.ruby-gemset +1 -1
  4. data/.ruby-version +1 -1
  5. data/.watchr +29 -16
  6. data/Appraisals +12 -4
  7. data/Gemfile +7 -6
  8. data/Gemfile.lock +156 -125
  9. data/MIT-LICENSE +1 -1
  10. data/README.md +77 -10
  11. data/Rakefile +5 -5
  12. data/act_with_flags.gemspec +20 -20
  13. data/gemfiles/rails_6.0.gemfile +4 -1
  14. data/gemfiles/{rails_5.2.gemfile → rails_6.1.gemfile} +3 -1
  15. data/gemfiles/rails_7.0.gemfile +15 -0
  16. data/lib/act_with_flags/admin.rb +5 -48
  17. data/lib/act_with_flags/clear.rb +30 -0
  18. data/lib/act_with_flags/define.rb +6 -35
  19. data/lib/act_with_flags/flags.rb +65 -0
  20. data/lib/act_with_flags/print.rb +21 -27
  21. data/lib/act_with_flags/utils.rb +33 -13
  22. data/lib/act_with_flags/version.rb +9 -13
  23. data/lib/act_with_flags.rb +28 -33
  24. data/test/any_all_none_test.rb +6 -9
  25. data/test/benchmark_test.rb +73 -0
  26. data/test/clear_test.rb +5 -7
  27. data/test/coding_check_add_test.rb +29 -0
  28. data/test/coding_coverage_test.rb +19 -0
  29. data/test/coding_mask2d_test.rb +25 -0
  30. data/test/coding_null_test.rb +29 -0
  31. data/test/coding_one_test.rb +26 -0
  32. data/test/coding_reset_test.rb +18 -0
  33. data/test/inheritance_any_test.rb +9 -33
  34. data/test/inheritance_test.rb +7 -10
  35. data/test/internal/app/controllers/orders_controller.rb +1 -3
  36. data/test/internal/app/models/order.rb +1 -5
  37. data/test/internal/config/routes.rb +1 -1
  38. data/test/internal/db/schema.rb +6 -7
  39. data/test/legacy_test.rb +8 -9
  40. data/test/mask_test.rb +6 -7
  41. data/test/null_test.rb +3 -5
  42. data/test/one_test.rb +7 -9
  43. data/test/origin_test.rb +7 -26
  44. data/test/origins_test.rb +57 -0
  45. data/test/range_test.rb +89 -0
  46. data/test/remove_from_test.rb +3 -4
  47. data/test/test_helper.rb +9 -9
  48. metadata +47 -67
  49. data/.rubocop.yml +0 -8
  50. data/.travis.yml +0 -23
  51. data/test/internal_benchmark_test.rb +0 -52
  52. data/test/internal_check_add_test.rb +0 -36
  53. data/test/internal_null_test.rb +0 -29
  54. data/test/internal_one_test.rb +0 -27
  55. data/test/reset_test.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fc915221f76638c08f3c7d73337c2ceab624f6525e4bc2246edf810ad1adca8
4
- data.tar.gz: ce62f053478b0b27c9f3c9a0d5d4f353e95d873d75e36fd8a78194c555fd7a03
3
+ metadata.gz: 4e2b18cdaf7777bddb191c830bc942a6fd7c377a4267c8e7beae3b2ace3552e9
4
+ data.tar.gz: 1aed1f1e86fdbdd1cff793c0296c1b6e23c7400dc43f7df17ad8e13c3b1998d0
5
5
  SHA512:
6
- metadata.gz: 5b4bc81cc1fa4fa3956ac91bb63e2a56c3612e56193a9758e187c16b316514d45d4e62d1a341ca6a6ab1a4a0c109dcbdbe6efbfe5ee83f09f5152bc908f16708
7
- data.tar.gz: aa6db748397688df46f02236f5c7fb02b2fab5a2be1884dcc432bdd2b7efe61215acf5d7e41a7b19643914633e4aa228a8265a32d441e1a62e9003512043d63e
6
+ metadata.gz: 11154bcaf21ff519f34863fdb847ffefd1e9a2fb493cfcdd8d0e015de42b601a9b3bf20d9e914d0e8681f39e321194ba3a27048a74fb43ce3972b9844cf0f14c
7
+ data.tar.gz: 4471f2dc9a7b48654fa9ea689e4f51e660f6eacb0012fc1ea75c43fd2cb9c91149c49243e24a78e4527407d4c75dd51e7b0066095efebb14f007eb3dda36a839
@@ -0,0 +1,30 @@
1
+ # see also https://github.com/whitequark/parser/blob/master/.github/workflows/test.yml
2
+ name: Rake
3
+
4
+ #on: [push, pull_request]
5
+ on: [push]
6
+
7
+ jobs:
8
+ test:
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ # os: [ubuntu-latest, macos-latest]
13
+ os: [ubuntu-latest]
14
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
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"]
17
+ test_command: ["bundle exec rake test"]
18
+ runs-on: ${{ matrix.os }}
19
+
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ - name: Bundle install
26
+ run: |
27
+ bundle config path /home/runner/bundle
28
+ bundle install
29
+ bundle update
30
+ - run: ${{ matrix.test_command }}
data/.ruby-gemset CHANGED
@@ -1 +1 @@
1
- rails-6.0
1
+ rails-7.0
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.6.6
1
+ ruby-3.1.2
data/.watchr CHANGED
@@ -1,5 +1,6 @@
1
- HH = '#' * 22 unless defined?(HH)
2
- H = '#' * 5 unless defined?(H)
1
+ TESTING = %w[test]
2
+ HH = "#" * 22 unless defined?(HH)
3
+ H = "#" * 5 unless defined?(H)
3
4
 
4
5
  def usage
5
6
  puts <<-EOS
@@ -14,35 +15,47 @@ def run(cmd)
14
15
  system "/usr/bin/time --format '#{HH} Elapsed time %E' #{cmd}"
15
16
  end
16
17
 
17
- def run_it(type, file)
18
- case type
19
- when 'test'; run %(ruby -I test #{file})
20
- # when 'spec'; run %(rspec -X #{file})
21
- else; puts "#{H} unknown type: #{type}, file: #{file}"
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
22
25
  end
23
26
  end
24
27
 
25
28
  def run_all_tests
26
29
  puts "\n#{HH} Running all tests #{HH}\n"
27
- %w[test spec].each { |dir| run "rake #{dir}" if File.exist?(dir) }
30
+ TESTING.each { |dir| run "bundle exec rake #{dir}" if File.exist?(dir) }
28
31
  end
29
32
 
30
33
  def run_matching_files(base)
31
- base = base.split('_').first
32
- %w[test spec].each { |type|
34
+ base = base.split("_").first
35
+ TESTING.each { |type|
33
36
  files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*\.rb/ }
34
- run_it type, files.join(' ') unless files.empty?
37
+ run_it type, files.join(" ") unless files.empty?
35
38
  }
36
39
  end
37
40
 
38
- %w[test spec].each { |type|
41
+ TESTING.each { |type|
39
42
  watch("#{type}/#{type}_helper\.rb") { run_all_tests }
40
- watch('lib/.*\.rb') { run_all_tests }
41
- watch("#{type}/.*/*_#{type}\.rb") { |match| run_it type, match[0] }
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
+ }
42
55
  }
43
56
 
44
57
  # Ctrl-\ or ctrl-4
45
- Signal.trap('QUIT') { run_all_tests }
58
+ Signal.trap("QUIT") { run_all_tests }
46
59
  # Ctrl-C
47
- Signal.trap('INT') { abort("Interrupted\n") }
60
+ Signal.trap("INT") { abort("Interrupted\n") }
48
61
  usage
data/Appraisals CHANGED
@@ -1,7 +1,15 @@
1
- appraise 'rails-6.0' do
2
- gem 'rails', '~> 6.0.0'
1
+ appraise "rails-7.0" do
2
+ gem "rails", "~> 7.0"
3
3
  end
4
4
 
5
- appraise 'rails-5.2' do
6
- gem 'rails', '~> 5.2.0'
5
+ # appraise "rails-6.1" do
6
+ # gem "rails", "~> 6.0"
7
+ # end
8
+
9
+ appraise "rails-6.0" do
10
+ gem "rails", "~> 6.0.0"
7
11
  end
12
+
13
+ # appraise 'rails-5.2' do
14
+ # gem 'rails', '~> 5.2.0'
15
+ # end
data/Gemfile CHANGED
@@ -1,11 +1,12 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
- gem 'rails'
4
+ gem "rails"
5
5
 
6
6
  group :test do
7
- gem 'observr'
8
- gem 'rubocop', require: false
9
- gem 'simplecov', require: false
10
- gem 'benchmark-ips'
7
+ gem "observr"
8
+ gem "standardrb", require: false
9
+ gem "simplecov", require: false
10
+ gem "benchmark-ips"
11
+ gem "ricecream"
11
12
  end
data/Gemfile.lock CHANGED
@@ -1,187 +1,218 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- act_with_flags (0.2.3)
4
+ act_with_flags (3.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actioncable (6.0.3.2)
10
- actionpack (= 6.0.3.2)
9
+ actioncable (7.0.3.1)
10
+ actionpack (= 7.0.3.1)
11
+ activesupport (= 7.0.3.1)
11
12
  nio4r (~> 2.0)
12
13
  websocket-driver (>= 0.6.1)
13
- actionmailbox (6.0.3.2)
14
- actionpack (= 6.0.3.2)
15
- activejob (= 6.0.3.2)
16
- activerecord (= 6.0.3.2)
17
- activestorage (= 6.0.3.2)
18
- activesupport (= 6.0.3.2)
14
+ actionmailbox (7.0.3.1)
15
+ actionpack (= 7.0.3.1)
16
+ activejob (= 7.0.3.1)
17
+ activerecord (= 7.0.3.1)
18
+ activestorage (= 7.0.3.1)
19
+ activesupport (= 7.0.3.1)
19
20
  mail (>= 2.7.1)
20
- actionmailer (6.0.3.2)
21
- actionpack (= 6.0.3.2)
22
- actionview (= 6.0.3.2)
23
- activejob (= 6.0.3.2)
21
+ net-imap
22
+ net-pop
23
+ net-smtp
24
+ actionmailer (7.0.3.1)
25
+ actionpack (= 7.0.3.1)
26
+ actionview (= 7.0.3.1)
27
+ activejob (= 7.0.3.1)
28
+ activesupport (= 7.0.3.1)
24
29
  mail (~> 2.5, >= 2.5.4)
30
+ net-imap
31
+ net-pop
32
+ net-smtp
25
33
  rails-dom-testing (~> 2.0)
26
- actionpack (6.0.3.2)
27
- actionview (= 6.0.3.2)
28
- activesupport (= 6.0.3.2)
29
- rack (~> 2.0, >= 2.0.8)
34
+ actionpack (7.0.3.1)
35
+ actionview (= 7.0.3.1)
36
+ activesupport (= 7.0.3.1)
37
+ rack (~> 2.0, >= 2.2.0)
30
38
  rack-test (>= 0.6.3)
31
39
  rails-dom-testing (~> 2.0)
32
40
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
33
- actiontext (6.0.3.2)
34
- actionpack (= 6.0.3.2)
35
- activerecord (= 6.0.3.2)
36
- activestorage (= 6.0.3.2)
37
- activesupport (= 6.0.3.2)
41
+ actiontext (7.0.3.1)
42
+ actionpack (= 7.0.3.1)
43
+ activerecord (= 7.0.3.1)
44
+ activestorage (= 7.0.3.1)
45
+ activesupport (= 7.0.3.1)
46
+ globalid (>= 0.6.0)
38
47
  nokogiri (>= 1.8.5)
39
- actionview (6.0.3.2)
40
- activesupport (= 6.0.3.2)
48
+ actionview (7.0.3.1)
49
+ activesupport (= 7.0.3.1)
41
50
  builder (~> 3.1)
42
51
  erubi (~> 1.4)
43
52
  rails-dom-testing (~> 2.0)
44
53
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
45
- activejob (6.0.3.2)
46
- activesupport (= 6.0.3.2)
54
+ activejob (7.0.3.1)
55
+ activesupport (= 7.0.3.1)
47
56
  globalid (>= 0.3.6)
48
- activemodel (6.0.3.2)
49
- activesupport (= 6.0.3.2)
50
- activerecord (6.0.3.2)
51
- activemodel (= 6.0.3.2)
52
- activesupport (= 6.0.3.2)
53
- activestorage (6.0.3.2)
54
- actionpack (= 6.0.3.2)
55
- activejob (= 6.0.3.2)
56
- activerecord (= 6.0.3.2)
57
- marcel (~> 0.3.1)
58
- activesupport (6.0.3.2)
57
+ activemodel (7.0.3.1)
58
+ activesupport (= 7.0.3.1)
59
+ activerecord (7.0.3.1)
60
+ activemodel (= 7.0.3.1)
61
+ activesupport (= 7.0.3.1)
62
+ activestorage (7.0.3.1)
63
+ actionpack (= 7.0.3.1)
64
+ activejob (= 7.0.3.1)
65
+ activerecord (= 7.0.3.1)
66
+ activesupport (= 7.0.3.1)
67
+ marcel (~> 1.0)
68
+ mini_mime (>= 1.1.0)
69
+ activesupport (7.0.3.1)
59
70
  concurrent-ruby (~> 1.0, >= 1.0.2)
60
- i18n (>= 0.7, < 2)
61
- minitest (~> 5.1)
62
- tzinfo (~> 1.1)
63
- zeitwerk (~> 2.2, >= 2.2.2)
64
- appraisal (2.3.0)
71
+ i18n (>= 1.6, < 2)
72
+ minitest (>= 5.1)
73
+ tzinfo (~> 2.0)
74
+ appraisal (2.4.1)
65
75
  bundler
66
76
  rake
67
77
  thor (>= 0.14.0)
68
- ast (2.4.1)
69
- benchmark-ips (2.8.2)
78
+ ast (2.4.2)
79
+ benchmark-ips (2.10.0)
70
80
  builder (3.2.4)
71
- combustion (1.3.0)
81
+ combustion (1.3.7)
72
82
  activesupport (>= 3.0.0)
73
83
  railties (>= 3.0.0)
74
84
  thor (>= 0.14.6)
75
- concurrent-ruby (1.1.6)
85
+ concurrent-ruby (1.1.10)
76
86
  crass (1.0.6)
77
- docile (1.3.2)
78
- erubi (1.9.0)
79
- globalid (0.4.2)
80
- activesupport (>= 4.2.0)
81
- i18n (1.8.3)
87
+ digest (3.1.0)
88
+ docile (1.4.0)
89
+ erubi (1.11.0)
90
+ globalid (1.0.0)
91
+ activesupport (>= 5.0)
92
+ i18n (1.12.0)
82
93
  concurrent-ruby (~> 1.0)
83
- loofah (2.6.0)
94
+ json (2.6.2)
95
+ loofah (2.18.0)
84
96
  crass (~> 1.0.2)
85
97
  nokogiri (>= 1.5.9)
86
98
  mail (2.7.1)
87
99
  mini_mime (>= 0.1.1)
88
- marcel (0.3.3)
89
- mimemagic (~> 0.3.2)
100
+ marcel (1.0.2)
90
101
  method_source (1.0.0)
91
- mimemagic (0.3.5)
92
- mini_mime (1.0.2)
93
- mini_portile2 (2.4.0)
94
- minitest (5.14.1)
95
- nio4r (2.5.2)
96
- nokogiri (1.10.10)
97
- mini_portile2 (~> 2.4.0)
102
+ mini_mime (1.1.2)
103
+ minitest (5.16.3)
104
+ net-imap (0.2.3)
105
+ digest
106
+ net-protocol
107
+ strscan
108
+ net-pop (0.1.1)
109
+ digest
110
+ net-protocol
111
+ timeout
112
+ net-protocol (0.1.3)
113
+ timeout
114
+ net-smtp (0.3.1)
115
+ digest
116
+ net-protocol
117
+ timeout
118
+ nio4r (2.5.8)
119
+ nokogiri (1.13.8-x86_64-linux)
120
+ racc (~> 1.4)
98
121
  observr (1.0.5)
99
- parallel (1.19.2)
100
- parser (2.7.1.4)
122
+ parallel (1.22.1)
123
+ parser (3.1.2.1)
101
124
  ast (~> 2.4.1)
102
- rack (2.2.3)
103
- rack-test (1.1.0)
104
- rack (>= 1.0, < 3)
105
- rails (6.0.3.2)
106
- actioncable (= 6.0.3.2)
107
- actionmailbox (= 6.0.3.2)
108
- actionmailer (= 6.0.3.2)
109
- actionpack (= 6.0.3.2)
110
- actiontext (= 6.0.3.2)
111
- actionview (= 6.0.3.2)
112
- activejob (= 6.0.3.2)
113
- activemodel (= 6.0.3.2)
114
- activerecord (= 6.0.3.2)
115
- activestorage (= 6.0.3.2)
116
- activesupport (= 6.0.3.2)
117
- bundler (>= 1.3.0)
118
- railties (= 6.0.3.2)
119
- sprockets-rails (>= 2.0.0)
125
+ racc (1.6.0)
126
+ rack (2.2.4)
127
+ rack-test (2.0.2)
128
+ rack (>= 1.3)
129
+ rails (7.0.3.1)
130
+ actioncable (= 7.0.3.1)
131
+ actionmailbox (= 7.0.3.1)
132
+ actionmailer (= 7.0.3.1)
133
+ actionpack (= 7.0.3.1)
134
+ actiontext (= 7.0.3.1)
135
+ actionview (= 7.0.3.1)
136
+ activejob (= 7.0.3.1)
137
+ activemodel (= 7.0.3.1)
138
+ activerecord (= 7.0.3.1)
139
+ activestorage (= 7.0.3.1)
140
+ activesupport (= 7.0.3.1)
141
+ bundler (>= 1.15.0)
142
+ railties (= 7.0.3.1)
120
143
  rails-dom-testing (2.0.3)
121
144
  activesupport (>= 4.2.0)
122
145
  nokogiri (>= 1.6)
123
- rails-html-sanitizer (1.3.0)
146
+ rails-html-sanitizer (1.4.3)
124
147
  loofah (~> 2.3)
125
- railties (6.0.3.2)
126
- actionpack (= 6.0.3.2)
127
- activesupport (= 6.0.3.2)
148
+ railties (7.0.3.1)
149
+ actionpack (= 7.0.3.1)
150
+ activesupport (= 7.0.3.1)
128
151
  method_source
129
- rake (>= 0.8.7)
130
- thor (>= 0.20.3, < 2.0)
131
- rainbow (3.0.0)
132
- rake (13.0.1)
133
- regexp_parser (1.7.1)
134
- rexml (3.2.4)
135
- rubocop (0.88.0)
152
+ rake (>= 12.2)
153
+ thor (~> 1.0)
154
+ zeitwerk (~> 2.5)
155
+ rainbow (3.1.1)
156
+ rake (13.0.6)
157
+ regexp_parser (2.5.0)
158
+ rexml (3.2.5)
159
+ ricecream (0.2.1)
160
+ rubocop (1.35.0)
161
+ json (~> 2.3)
136
162
  parallel (~> 1.10)
137
- parser (>= 2.7.1.1)
163
+ parser (>= 3.1.2.1)
138
164
  rainbow (>= 2.2.2, < 4.0)
139
- regexp_parser (>= 1.7)
140
- rexml
141
- rubocop-ast (>= 0.1.0, < 1.0)
165
+ regexp_parser (>= 1.8, < 3.0)
166
+ rexml (>= 3.2.5, < 4.0)
167
+ rubocop-ast (>= 1.20.1, < 2.0)
142
168
  ruby-progressbar (~> 1.7)
143
- unicode-display_width (>= 1.4.0, < 2.0)
144
- rubocop-ast (0.1.0)
145
- parser (>= 2.7.0.1)
146
- ruby-progressbar (1.10.1)
147
- simplecov (0.18.5)
169
+ unicode-display_width (>= 1.4.0, < 3.0)
170
+ rubocop-ast (1.21.0)
171
+ parser (>= 3.1.1.0)
172
+ rubocop-performance (1.14.3)
173
+ rubocop (>= 1.7.0, < 2.0)
174
+ rubocop-ast (>= 0.4.0)
175
+ ruby-progressbar (1.11.0)
176
+ simplecov (0.21.2)
148
177
  docile (~> 1.1)
149
178
  simplecov-html (~> 0.11)
150
- simplecov-html (0.12.2)
151
- sprockets (4.0.2)
179
+ simplecov_json_formatter (~> 0.1)
180
+ simplecov-html (0.12.3)
181
+ simplecov_json_formatter (0.1.4)
182
+ sqlite3 (1.4.4)
183
+ standard (1.16.0)
184
+ rubocop (= 1.35.0)
185
+ rubocop-performance (= 1.14.3)
186
+ standardrb (1.0.1)
187
+ standard
188
+ strscan (3.0.4)
189
+ thor (1.2.1)
190
+ timeout (0.3.0)
191
+ tzinfo (2.0.5)
152
192
  concurrent-ruby (~> 1.0)
153
- rack (> 1, < 3)
154
- sprockets-rails (3.2.1)
155
- actionpack (>= 4.0)
156
- activesupport (>= 4.0)
157
- sprockets (>= 3.0.0)
158
- sqlite3 (1.4.2)
159
- thor (1.0.1)
160
- thread_safe (0.3.6)
161
- tzinfo (1.2.7)
162
- thread_safe (~> 0.1)
163
- unicode-display_width (1.7.0)
164
- websocket-driver (0.7.3)
193
+ unicode-display_width (2.2.0)
194
+ websocket-driver (0.7.5)
165
195
  websocket-extensions (>= 0.1.0)
166
196
  websocket-extensions (0.1.5)
167
- zeitwerk (2.3.1)
197
+ zeitwerk (2.6.0)
168
198
 
169
199
  PLATFORMS
170
- ruby
200
+ x86_64-linux
171
201
 
172
202
  DEPENDENCIES
173
203
  act_with_flags!
174
- appraisal (~> 2)
204
+ appraisal
175
205
  benchmark-ips
176
- bundler (~> 1)
177
- combustion (~> 1)
178
- minitest (~> 5.0)
206
+ bundler
207
+ combustion
208
+ minitest
179
209
  observr
180
210
  rails
181
- rake (~> 13)
182
- rubocop
211
+ rake
212
+ ricecream
183
213
  simplecov
184
- sqlite3 (~> 1)
214
+ sqlite3
215
+ standardrb
185
216
 
186
217
  BUNDLED WITH
187
- 1.17.3
218
+ 2.3.14
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2019-2020 Dittmar Krall - www.matique.com
1
+ Copyright 2019-2022 Dittmar Krall - www.matiq.com
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,27 +1,94 @@
1
1
  # ActWithFlags
2
+
2
3
  [![Gem Version](https://badge.fury.io/rb/act_with_flags.png)](http://badge.fury.io/rb/act_with_flags)
3
- [![Build Status](https://travis-ci.org/matique/act_with_flags.png?branch=master)](https://travis-ci.org/matique/act_with_flags)
4
4
 
5
- Required by key.matique.
5
+ A Rails gem required by key.matiq.
6
+
7
+ Handles booleans in "flags".
8
+ Defines setters and getters to access the booleans.
9
+
6
10
 
7
11
  ## Installation
8
12
 
9
- Add this line to your application's Gemfile:
13
+ As usual:
14
+ ```ruby
15
+ # Gemfile
16
+ ...
17
+ gem 'act_with_flags'
18
+ ```
19
+
20
+ or manually:
21
+ ```shell
22
+ $ gem install act_with_flags
23
+ ```
24
+
25
+
26
+ ## Version 3.1.x
27
+
28
+ Added option "range" limiting the position of booleans.
29
+
30
+ An example:
31
+ ```ruby
32
+ ii = 3
33
+ Order.add_to_flags range: (2..4), a: (ii += 1) # accepted
34
+ Order.add_to_flags range: (2..4), b: (ii += 1) # raises exception
35
+ ```
36
+
37
+ Option "range" enables an early static check.
38
+
39
+ Option "range" does not replace the dynamic "validate" in models,
40
+ which is strongly recommended for complex applications.
41
+ Due to Ruby "act_with_flags" can handle a huge quantity
42
+ of booleans in an integer (or a string),
43
+ but your database may fail above a certain amount of bits.
44
+
45
+ The option ":max_bits" is deprecated.
46
+
47
+
48
+ ## Version 3.0.x
49
+
50
+ As required by key.matiq an enhanced "origin:" has been implemented.
51
+ Act_with_flags now supports many "origin:"s
52
+ (not just renaming the default "flags").
53
+
54
+ An example:
55
+ ```ruby
56
+ Order.add_to_flags :a # origin is :flags
57
+ Order.add_to_flags :b, b2: 63 # origin is :flags
58
+ Order.add_to_flags :c, origin: :origin1
59
+ Order.add_to_flags d: 3, origin: :origin2
60
+ Order.add_to_flags :d2, origin: :origin2
61
+ ```
62
+
63
+ The default "origin:" continues to be "flags".
64
+
65
+
66
+ ## Testing
67
+
68
+ As "Best Practice" a test coverage of 100% has been achieved
69
+ (and should be kept).
70
+
71
+ GitHub workflow enable tests for several configurations.
72
+ Please, feel free to inspect the corresponding file.
10
73
 
11
- gem 'act_with_flags'
74
+ The "gem appraisal" is used for an additional set of configurations.
75
+ Feel free to inspect the corresponding file.
12
76
 
13
- And then execute:
14
77
 
15
- $ bundle
78
+ ## Links
16
79
 
17
- Or install it yourself as:
80
+ Further reading:
18
81
 
19
- $ gem install act_with_flags
82
+ - [gem bitmask_attributes](https://github.com/joelmoss/bitmask_attributes)
83
+ - [gem bitfields](https://github.com/grosser/bitfields)
84
+ - [gem active_flag](https://github.com/kenn/active_flag)
85
+ - [gem has-bit-field](https://github.com/pjb3/has-bit-field)
86
+ - [gem bitfield_attribute](https://github.com/gzigzigzeo/bitfield_attribute)
20
87
 
21
88
 
22
89
  ## License MIT
23
90
 
24
- ActWithFlags is Copyright (c) 2019 [Dittmar Krall](matique.com UG) and
25
- is released under the MIT license:
91
+ Copyright (c) 2019-2022 [Dittmar Krall](matiq UG (haftungsbeschränkt))
92
+ and is released under the MIT license:
26
93
 
27
94
  * https://opensource.org/licenses/MIT
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
- require 'rake/testtask'
1
+ require "rake/testtask"
2
2
 
3
- desc 'Run the tests.'
3
+ desc "Run the tests."
4
4
  Rake::TestTask.new do |t|
5
- t.libs << 'lib'
6
- t.libs << 'test'
7
- t.pattern = 'test/**/*_test.rb'
5
+ t.libs << "lib"
6
+ t.libs << "test"
7
+ t.pattern = "test/**/*_test.rb"
8
8
  t.verbose = false
9
9
  end
10
10