active_flag 1.6.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2410c1b0af6f52df6e74bbbb1dee7f4aa445d7914ec9f63caffc843a4f8453a0
4
- data.tar.gz: b4877beab21724bf362fe26fdeb3e3d7d9de532170a46acf638dcad36df15d09
3
+ metadata.gz: 95bb29c60494f354cd2030f43a1661d8bf470761e6c72a55f36fa67bd58a6ca0
4
+ data.tar.gz: b21537f0466989d7ba6ec4e9dd1508a81a2965dc25dd70fcd7c18569f54b3cce
5
5
  SHA512:
6
- metadata.gz: 84efcd90ecdc82c0e93074902a8bee8f88fb114035a1680808b1f53840e8224388d372872aa3d3d392ad4c36bd0bc5301d48eba21adb5a275b869c5b90d3098f
7
- data.tar.gz: 721d7dec4c58f396427bb50dfa4c577bf9aa23bfb871c27f4da8b1d20a9d1aa026e2ec163bdf58927548a4c28ff8f389008fb639d58f8b23f3d3c38c7fb68004
6
+ metadata.gz: 92731cf866d6be1d7165ce0ceea4cfccc60503933cc4d1a1b829e027e391fb778703c3b4c62290bbd49546315010208e896bfdab38b45b62eb2e0638d64bddf0
7
+ data.tar.gz: 6a44c95b29b5ed5f1c8c214ff6c2facc2c164b6bc48e219c3ca0f68c3e5e5fb9cd971a008e4bcd4b608d0ab4a6a158df07f7706b402a9eefffab0387fca9eb84
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,28 @@
1
+ name: ci
2
+ on: [pull_request, push]
3
+ jobs:
4
+ test:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ include:
9
+ - ruby: ruby-head
10
+ rails_version: '7.2'
11
+ - ruby: '3.3'
12
+ rails_version: '7.2'
13
+ - ruby: '3.2'
14
+ rails_version: '7.2'
15
+ - ruby: '3.1'
16
+ rails_version: '7.2'
17
+ - ruby: '3.1'
18
+ rails_version: '6.1'
19
+ runs-on: ubuntu-latest
20
+ env:
21
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.rails_version }}.gemfile
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{ matrix.ruby }}
27
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
28
+ - run: bundle exec rake
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .idea
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ActiveFlag - Bit array for ActiveRecord
2
2
 
3
- [![Build Status](https://travis-ci.org/kenn/active_flag.svg)](https://travis-ci.org/kenn/active_flag)
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/active_flag.gemspec CHANGED
@@ -20,8 +20,11 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_runtime_dependency 'activerecord', '>= 5'
23
+ spec.add_runtime_dependency 'logger'
24
+ spec.add_runtime_dependency 'mutex_m'
25
+ spec.add_runtime_dependency 'bigdecimal'
23
26
  spec.add_development_dependency 'bundler'
24
27
  spec.add_development_dependency 'rake'
25
28
  spec.add_development_dependency 'minitest'
26
- spec.add_development_dependency 'sqlite3'
29
+ spec.add_development_dependency 'sqlite3', '< 2'
27
30
  end
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '~> 6.1.0'
4
+
5
+ gemspec path: '../'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '~> 7.0.0'
4
+
5
+ gemspec path: '../'
@@ -1,3 +1,3 @@
1
1
  module ActiveFlag
2
- VERSION = '1.6.0'
2
+ VERSION = '2.0.2'
3
3
  end
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
- options, integer, column_name = send "_where_#{column}", *args
39
- if options[:op] == :and
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
- _options, integer, column_name = send "_where_#{column}", *args
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
- _options, integer, column_name = send "_where_#{column}", *args
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
- _options, integer, column_name = send "_where_#{column}", *args
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.quote_table_name_for_assignment(table_name, column)
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,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_flag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenn Ejima
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-03-21 00:00:00.000000000 Z
10
+ date: 2024-09-04 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activerecord
@@ -24,6 +23,48 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '5'
26
+ - !ruby/object:Gem::Dependency
27
+ name: logger
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: mutex_m
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: bigdecimal
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
27
68
  - !ruby/object:Gem::Dependency
28
69
  name: bundler
29
70
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +111,16 @@ dependencies:
70
111
  name: sqlite3
71
112
  requirement: !ruby/object:Gem::Requirement
72
113
  requirements:
73
- - - ">="
114
+ - - "<"
74
115
  - !ruby/object:Gem::Version
75
- version: '0'
116
+ version: '2'
76
117
  type: :development
77
118
  prerelease: false
78
119
  version_requirements: !ruby/object:Gem::Requirement
79
120
  requirements:
80
- - - ">="
121
+ - - "<"
81
122
  - !ruby/object:Gem::Version
82
- version: '0'
123
+ version: '2'
83
124
  description: Bit array for ActiveRecord
84
125
  email:
85
126
  - kenn.ejima@gmail.com
@@ -87,8 +128,9 @@ executables: []
87
128
  extensions: []
88
129
  extra_rdoc_files: []
89
130
  files:
131
+ - ".github/dependabot.yml"
132
+ - ".github/workflows/ci.yml"
90
133
  - ".gitignore"
91
- - ".travis.yml"
92
134
  - Gemfile
93
135
  - LICENSE
94
136
  - README.md
@@ -96,10 +138,8 @@ files:
96
138
  - active_flag.gemspec
97
139
  - bin/console
98
140
  - bin/setup
99
- - gemfiles/5.0.gemfile
100
- - gemfiles/5.1.gemfile
101
- - gemfiles/5.2.gemfile
102
- - gemfiles/6.0.gemfile
141
+ - gemfiles/6.1.gemfile
142
+ - gemfiles/7.2.gemfile
103
143
  - lib/active_flag.rb
104
144
  - lib/active_flag/definition.rb
105
145
  - lib/active_flag/railtie.rb
@@ -108,7 +148,6 @@ files:
108
148
  homepage: https://github.com/kenn/active_flag
109
149
  licenses: []
110
150
  metadata: {}
111
- post_install_message:
112
151
  rdoc_options: []
113
152
  require_paths:
114
153
  - lib
@@ -123,8 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
162
  - !ruby/object:Gem::Version
124
163
  version: '0'
125
164
  requirements: []
126
- rubygems_version: 3.0.9
127
- signing_key:
165
+ rubygems_version: 3.6.0.dev
128
166
  specification_version: 4
129
167
  summary: Bit array for ActiveRecord
130
168
  test_files: []
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.5
4
- - 2.6
5
- - 2.7
6
- before_install: gem install bundler -v 1.16.2
7
- gemfile:
8
- - gemfiles/5.0.gemfile
9
- - gemfiles/5.1.gemfile
10
- - gemfiles/5.2.gemfile
11
- - gemfiles/6.0.gemfile
data/gemfiles/5.0.gemfile DELETED
@@ -1,12 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activerecord", "~> 5.0"
4
-
5
- group :development, :test do
6
- gem "bundler"
7
- gem "rake"
8
- gem "minitest"
9
- gem "sqlite3"
10
- end
11
-
12
- gemspec :path => "../"
data/gemfiles/5.1.gemfile DELETED
@@ -1,12 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activerecord", "~> 5.1"
4
-
5
- group :development, :test do
6
- gem "bundler"
7
- gem "rake"
8
- gem "minitest"
9
- gem "sqlite3"
10
- end
11
-
12
- gemspec :path => "../"
data/gemfiles/5.2.gemfile DELETED
@@ -1,12 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activerecord", "~> 5.2"
4
-
5
- group :development, :test do
6
- gem "bundler"
7
- gem "rake"
8
- gem "minitest"
9
- gem "sqlite3"
10
- end
11
-
12
- gemspec :path => "../"
data/gemfiles/6.0.gemfile DELETED
@@ -1,12 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activerecord", "~> 6"
4
-
5
- group :development, :test do
6
- gem "bundler"
7
- gem "rake"
8
- gem "minitest"
9
- gem "sqlite3"
10
- end
11
-
12
- gemspec :path => "../"