active_record_bitmask 2.0.0 → 4.0.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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +13 -2
- data/Appraisals +6 -13
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -2
- data/active_record_bitmask.gemspec +1 -1
- data/gemfiles/7.0_stable.gemfile +1 -1
- data/gemfiles/7.1_stable.gemfile +1 -1
- data/gemfiles/7.2_stable.gemfile +1 -2
- data/gemfiles/{6.1_stable.gemfile → 8.0_stable.gemfile} +3 -4
- data/gemfiles/8.1_stable.gemfile +12 -0
- data/lib/active_record_bitmask/attribute_methods/query.rb +1 -13
- data/lib/active_record_bitmask/map.rb +1 -1
- data/lib/active_record_bitmask/model.rb +3 -15
- data/lib/active_record_bitmask/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c67b9f3ee778f6d9575125bb65144c0f6d12c59e967841e60b88a56812d07bc6
|
|
4
|
+
data.tar.gz: 92006f991710423ed2343c0ff53fcbcfd9185144cb61a26059039273e9ba891c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9dddfae3bbbdf110bc3380953af47049e3893f386f155ffd8bceda6fdadb6cf492aea229fe69ce41eb0de192de73464c5aad99065bff53132922272da31cac0d
|
|
7
|
+
data.tar.gz: 4a8055c7aa0ca191fdb87775e0ed3b987cae32ce86a66ac19d508b7efd1b8c1753c7e197c0ebe3fb7e93094efd90815bd1b789952f46d39d1dc7bba770fdae31
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -30,8 +30,19 @@ jobs:
|
|
|
30
30
|
runs-on: ubuntu-latest
|
|
31
31
|
strategy:
|
|
32
32
|
matrix:
|
|
33
|
-
gemfile:
|
|
34
|
-
|
|
33
|
+
gemfile:
|
|
34
|
+
- '7.2_stable'
|
|
35
|
+
- '8.0_stable'
|
|
36
|
+
- '8.1_stable'
|
|
37
|
+
ruby-version:
|
|
38
|
+
- '3.1'
|
|
39
|
+
- '3.2'
|
|
40
|
+
- '3.3'
|
|
41
|
+
exclude:
|
|
42
|
+
- ruby-version: '3.1'
|
|
43
|
+
gemfile: '8.0_stable'
|
|
44
|
+
- ruby-version: '3.1'
|
|
45
|
+
gemfile: '8.1_stable'
|
|
35
46
|
env:
|
|
36
47
|
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
|
37
48
|
steps:
|
data/Appraisals
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
appraise '
|
|
4
|
-
gem 'activerecord', '~>
|
|
5
|
-
gem 'sqlite3', '~> 1.7.0'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
appraise '7.0-stable' do
|
|
9
|
-
gem 'activerecord', '~> 7.0.0'
|
|
10
|
-
gem 'sqlite3', '~> 1.7.0'
|
|
3
|
+
appraise '7.2-stable' do
|
|
4
|
+
gem 'activerecord', '~> 7.2.0'
|
|
11
5
|
end
|
|
12
6
|
|
|
13
|
-
appraise '
|
|
14
|
-
gem 'activerecord', '~>
|
|
15
|
-
gem 'sqlite3', '~> 1.7.0'
|
|
7
|
+
appraise '8.0-stable' do
|
|
8
|
+
gem 'activerecord', '~> 8.0.0'
|
|
16
9
|
end
|
|
17
10
|
|
|
18
|
-
appraise '
|
|
19
|
-
gem 'activerecord', '~>
|
|
11
|
+
appraise '8.1-stable' do
|
|
12
|
+
gem 'activerecord', '~> 8.1.0'
|
|
20
13
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 4.0.0
|
|
2
|
+
|
|
3
|
+
* Bump up rubocop version #31
|
|
4
|
+
* **Breaking Changes** Rails 7.0 and 7.1 are no longer supported. #32
|
|
5
|
+
* Support Rails 8.1.0 #33
|
|
6
|
+
|
|
7
|
+
## 3.0.0
|
|
8
|
+
|
|
9
|
+
* **Breaking Changes** Rails 6.1 is no longer supported. #30
|
|
10
|
+
* Support Rails 8.0.0 #30
|
|
11
|
+
|
|
1
12
|
## 2.0.0
|
|
2
13
|
|
|
3
14
|
* **Breaking Changes** Rails 6.0 is no longer supported. #28
|
data/Gemfile
CHANGED
data/gemfiles/7.0_stable.gemfile
CHANGED
data/gemfiles/7.1_stable.gemfile
CHANGED
data/gemfiles/7.2_stable.gemfile
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
|
-
gem "
|
|
6
|
-
gem "rubocop", "1.28.2"
|
|
5
|
+
gem "rubocop", "1.82.1"
|
|
7
6
|
gem "appraisal"
|
|
8
7
|
gem "rake"
|
|
9
8
|
gem "rspec"
|
|
10
|
-
gem "sqlite3"
|
|
11
|
-
gem "activerecord", "~>
|
|
9
|
+
gem "sqlite3"
|
|
10
|
+
gem "activerecord", "~> 8.0.0"
|
|
12
11
|
|
|
13
12
|
gemspec path: "../"
|
|
@@ -18,18 +18,6 @@ module ActiveRecordBitmask
|
|
|
18
18
|
self.class.bitmasks.key?(attribute_name.to_sym)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
if ActiveRecord.gem_version < Gem::Version.create('7.0.0.alpha1')
|
|
22
|
-
# In Rails 7.0.0, calling attribute? with arguments is not working.
|
|
23
|
-
def attribute?(attribute_name, *values)
|
|
24
|
-
if bitmask_attribute?(attribute_name) && values.present?
|
|
25
|
-
ActiveSupport::Deprecation.warn("`#{attribute_name}?(*args)` is deprecated and will be removed in next major version. Call `#{attribute_name}_bitmask?(*args)` instead.")
|
|
26
|
-
attribute_bitmask?(attribute_name, *values)
|
|
27
|
-
else
|
|
28
|
-
super
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
21
|
def attribute_bitmask?(attribute_name, *values)
|
|
34
22
|
if bitmask_attribute?(attribute_name) && values.present?
|
|
35
23
|
# assert bitmask values
|
|
@@ -37,7 +25,7 @@ module ActiveRecordBitmask
|
|
|
37
25
|
expected_value = map.attributes_to_bitmask(values)
|
|
38
26
|
current_value = map.attributes_to_bitmask(attribute(attribute_name))
|
|
39
27
|
|
|
40
|
-
(
|
|
28
|
+
current_value.allbits?(expected_value)
|
|
41
29
|
else
|
|
42
30
|
attribute?(attribute_name)
|
|
43
31
|
end
|
|
@@ -9,6 +9,7 @@ module ActiveRecordBitmask
|
|
|
9
9
|
|
|
10
10
|
included do
|
|
11
11
|
include ActiveRecordBitmask::AttributeMethods::Query
|
|
12
|
+
|
|
12
13
|
class_attribute(:bitmasks, instance_accessor: false)
|
|
13
14
|
|
|
14
15
|
# `class_attribute` on Rails 5.0 doesn't support default option.
|
|
@@ -51,21 +52,8 @@ module ActiveRecordBitmask
|
|
|
51
52
|
private
|
|
52
53
|
|
|
53
54
|
def define_bitmask_attribute(attribute, map)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
decorate_attributes([attribute]) do |name, subtype|
|
|
57
|
-
ActiveRecordBitmask::BitmaskType.new(name, map, subtype)
|
|
58
|
-
end
|
|
59
|
-
elsif ActiveRecord.gem_version >= Gem::Version.new('7.0.0')
|
|
60
|
-
# Greater than or equal to 7.0.0
|
|
61
|
-
attribute(attribute) do |subtype|
|
|
62
|
-
ActiveRecordBitmask::BitmaskType.new(attribute, map, subtype)
|
|
63
|
-
end
|
|
64
|
-
else
|
|
65
|
-
# Equal to 6.1.0
|
|
66
|
-
decorate_attribute_type(attribute) do |subtype|
|
|
67
|
-
ActiveRecordBitmask::BitmaskType.new(attribute, map, subtype)
|
|
68
|
-
end
|
|
55
|
+
decorate_attributes([attribute]) do |name, subtype|
|
|
56
|
+
ActiveRecordBitmask::BitmaskType.new(name, map, subtype)
|
|
69
57
|
end
|
|
70
58
|
end
|
|
71
59
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_record_bitmask
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- alpaca-tc
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '7.2'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '7.2'
|
|
27
27
|
description:
|
|
28
28
|
email:
|
|
29
29
|
- alpaca-tc@alpaca.tc
|
|
@@ -41,10 +41,11 @@ files:
|
|
|
41
41
|
- README.md
|
|
42
42
|
- Rakefile
|
|
43
43
|
- active_record_bitmask.gemspec
|
|
44
|
-
- gemfiles/6.1_stable.gemfile
|
|
45
44
|
- gemfiles/7.0_stable.gemfile
|
|
46
45
|
- gemfiles/7.1_stable.gemfile
|
|
47
46
|
- gemfiles/7.2_stable.gemfile
|
|
47
|
+
- gemfiles/8.0_stable.gemfile
|
|
48
|
+
- gemfiles/8.1_stable.gemfile
|
|
48
49
|
- lib/active_record_bitmask.rb
|
|
49
50
|
- lib/active_record_bitmask/attribute_methods.rb
|
|
50
51
|
- lib/active_record_bitmask/attribute_methods/query.rb
|
|
@@ -75,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
75
76
|
- !ruby/object:Gem::Version
|
|
76
77
|
version: '0'
|
|
77
78
|
requirements: []
|
|
78
|
-
rubygems_version: 3.
|
|
79
|
+
rubygems_version: 3.4.7
|
|
79
80
|
signing_key:
|
|
80
81
|
specification_version: 4
|
|
81
82
|
summary: Simple bitmask attribute support for ActiveRecord
|