active_flag 1.6.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +34 -0
- data/.gitignore +1 -0
- data/README.md +1 -1
- data/gemfiles/5.0.gemfile +3 -10
- data/gemfiles/5.1.gemfile +3 -10
- data/gemfiles/5.2.gemfile +3 -10
- data/gemfiles/6.0.gemfile +3 -10
- data/gemfiles/6.1.gemfile +5 -0
- data/gemfiles/7.0.gemfile +5 -0
- data/lib/active_flag/version.rb +1 -1
- data/lib/active_flag.rb +7 -12
- metadata +7 -4
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82f147cd96182a6ca152eac3fee6a96f96ece8d3c209430c25b65a3a2a9e77bc
|
4
|
+
data.tar.gz: 668c06b6d9d999e412dd5c69d3c9ce756940baea19be40d54d1434104abf01ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fde22cc83423b2cd35c3b1bc5755a34bf47808cfe0916c3e86488fdecdd28e1895fe6167af1e5cc941b214144e65141c22b46a0dfc409bef0de83a540c2a9537
|
7
|
+
data.tar.gz: eab5b8de5a932f52ee03d598bc37f45b69289390e3002dc33c9026ddbbb5e3d082a723b7acb5db45ea0f2cd56c767804bc141b8eefd6b983fecfb728c820b6be
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: ci
|
2
|
+
on: [pull_request, push]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
test:
|
6
|
+
strategy:
|
7
|
+
fail-fast: false
|
8
|
+
matrix:
|
9
|
+
ruby:
|
10
|
+
- '3.3'
|
11
|
+
- '3.2'
|
12
|
+
- '3.1'
|
13
|
+
- ruby-head
|
14
|
+
rails_version:
|
15
|
+
- '7.2'
|
16
|
+
- '6.1'
|
17
|
+
exclude:
|
18
|
+
- ruby: '3.2'
|
19
|
+
rails_version: '6.1'
|
20
|
+
- ruby: '3.3'
|
21
|
+
rails_version: '6.1'
|
22
|
+
- ruby: ruby-head
|
23
|
+
rails_version: '6.1'
|
24
|
+
runs-on: ubuntu-latest
|
25
|
+
env:
|
26
|
+
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails_version }}.gemfile
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v4
|
29
|
+
- uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
bundler: true
|
32
|
+
ruby-version: ${{ matrix.ruby }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- run: bundle exec rake
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ActiveFlag - Bit array for ActiveRecord
|
2
2
|
|
3
|
-
|
3
|
+
![Build Status](https://github.com/kenn/active_flag/actions/workflows/ci.yml/badge.svg)
|
4
4
|
|
5
5
|
Store up to 64 multiple flags ([bit array](https://en.wikipedia.org/wiki/Bit_array)) in a single integer column with ActiveRecord. From a UI standpoint, it can be used as a multi-select checkbox storage.
|
6
6
|
|
data/gemfiles/5.0.gemfile
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem
|
3
|
+
gem 'activerecord', '~> 5.0.0'
|
4
4
|
|
5
|
-
|
6
|
-
gem "bundler"
|
7
|
-
gem "rake"
|
8
|
-
gem "minitest"
|
9
|
-
gem "sqlite3"
|
10
|
-
end
|
11
|
-
|
12
|
-
gemspec :path => "../"
|
5
|
+
gemspec path: '../'
|
data/gemfiles/5.1.gemfile
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem
|
3
|
+
gem 'activerecord', '~> 5.1.1'
|
4
4
|
|
5
|
-
|
6
|
-
gem "bundler"
|
7
|
-
gem "rake"
|
8
|
-
gem "minitest"
|
9
|
-
gem "sqlite3"
|
10
|
-
end
|
11
|
-
|
12
|
-
gemspec :path => "../"
|
5
|
+
gemspec path: '../'
|
data/gemfiles/5.2.gemfile
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem
|
3
|
+
gem 'activerecord', '~> 5.2.0'
|
4
4
|
|
5
|
-
|
6
|
-
gem "bundler"
|
7
|
-
gem "rake"
|
8
|
-
gem "minitest"
|
9
|
-
gem "sqlite3"
|
10
|
-
end
|
11
|
-
|
12
|
-
gemspec :path => "../"
|
5
|
+
gemspec path: '../'
|
data/gemfiles/6.0.gemfile
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem
|
3
|
+
gem 'activerecord', '~> 6.0.0'
|
4
4
|
|
5
|
-
|
6
|
-
gem "bundler"
|
7
|
-
gem "rake"
|
8
|
-
gem "minitest"
|
9
|
-
gem "sqlite3"
|
10
|
-
end
|
11
|
-
|
12
|
-
gemspec :path => "../"
|
5
|
+
gemspec path: '../'
|
data/lib/active_flag/version.rb
CHANGED
data/lib/active_flag.rb
CHANGED
@@ -35,35 +35,30 @@ module ActiveFlag
|
|
35
35
|
|
36
36
|
# Scopes
|
37
37
|
define_singleton_method "where_#{column}" do |*args|
|
38
|
-
|
39
|
-
|
40
|
-
ActiveSupport::Deprecation.warn('op: :and is deprecated, use where_all instead')
|
41
|
-
where("#{column_name} & #{integer} = #{integer}")
|
42
|
-
else
|
43
|
-
where("#{column_name} & #{integer} > 0")
|
44
|
-
end
|
38
|
+
integer, column_name = send("_where_#{column}", *args)
|
39
|
+
where("#{column_name} & #{integer} > 0")
|
45
40
|
end
|
46
41
|
|
47
42
|
define_singleton_method "where_all_#{column}" do |*args|
|
48
|
-
|
43
|
+
integer, column_name = send("_where_#{column}", *args)
|
49
44
|
where("#{column_name} & #{integer} = #{integer}")
|
50
45
|
end
|
51
46
|
|
52
47
|
define_singleton_method "where_not_#{column}" do |*args|
|
53
|
-
|
48
|
+
integer, column_name = send("_where_#{column}", *args)
|
54
49
|
where("#{column_name} & #{integer} = 0")
|
55
50
|
end
|
56
51
|
|
57
52
|
define_singleton_method "where_not_all_#{column}" do |*args|
|
58
|
-
|
53
|
+
integer, column_name = send("_where_#{column}", *args)
|
59
54
|
where("#{column_name} & #{integer} < #{integer}")
|
60
55
|
end
|
61
56
|
|
57
|
+
# utility method to extract parameters
|
62
58
|
define_singleton_method "_where_#{column}" do |*args|
|
63
59
|
return [
|
64
|
-
args.extract_options!,
|
65
60
|
active_flags[column].to_i(args),
|
66
|
-
connection.
|
61
|
+
"#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column)}"
|
67
62
|
]
|
68
63
|
end
|
69
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_flag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenn Ejima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -87,8 +87,9 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/dependabot.yml"
|
91
|
+
- ".github/workflows/ci.yml"
|
90
92
|
- ".gitignore"
|
91
|
-
- ".travis.yml"
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE
|
94
95
|
- README.md
|
@@ -100,6 +101,8 @@ files:
|
|
100
101
|
- gemfiles/5.1.gemfile
|
101
102
|
- gemfiles/5.2.gemfile
|
102
103
|
- gemfiles/6.0.gemfile
|
104
|
+
- gemfiles/6.1.gemfile
|
105
|
+
- gemfiles/7.0.gemfile
|
103
106
|
- lib/active_flag.rb
|
104
107
|
- lib/active_flag/definition.rb
|
105
108
|
- lib/active_flag/railtie.rb
|
@@ -123,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
126
|
- !ruby/object:Gem::Version
|
124
127
|
version: '0'
|
125
128
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
129
|
+
rubygems_version: 3.5.16
|
127
130
|
signing_key:
|
128
131
|
specification_version: 4
|
129
132
|
summary: Bit array for ActiveRecord
|