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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2410c1b0af6f52df6e74bbbb1dee7f4aa445d7914ec9f63caffc843a4f8453a0
4
- data.tar.gz: b4877beab21724bf362fe26fdeb3e3d7d9de532170a46acf638dcad36df15d09
3
+ metadata.gz: 82f147cd96182a6ca152eac3fee6a96f96ece8d3c209430c25b65a3a2a9e77bc
4
+ data.tar.gz: 668c06b6d9d999e412dd5c69d3c9ce756940baea19be40d54d1434104abf01ee
5
5
  SHA512:
6
- metadata.gz: 84efcd90ecdc82c0e93074902a8bee8f88fb114035a1680808b1f53840e8224388d372872aa3d3d392ad4c36bd0bc5301d48eba21adb5a275b869c5b90d3098f
7
- data.tar.gz: 721d7dec4c58f396427bb50dfa4c577bf9aa23bfb871c27f4da8b1d20a9d1aa026e2ec163bdf58927548a4c28ff8f389008fb639d58f8b23f3d3c38c7fb68004
6
+ metadata.gz: fde22cc83423b2cd35c3b1bc5755a34bf47808cfe0916c3e86488fdecdd28e1895fe6167af1e5cc941b214144e65141c22b46a0dfc409bef0de83a540c2a9537
7
+ data.tar.gz: eab5b8de5a932f52ee03d598bc37f45b69289390e3002dc33c9026ddbbb5e3d082a723b7acb5db45ea0f2cd56c767804bc141b8eefd6b983fecfb728c820b6be
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -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
@@ -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/gemfiles/5.0.gemfile CHANGED
@@ -1,12 +1,5 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "activerecord", "~> 5.0"
3
+ gem 'activerecord', '~> 5.0.0'
4
4
 
5
- group :development, :test do
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 "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "activerecord", "~> 5.1"
3
+ gem 'activerecord', '~> 5.1.1'
4
4
 
5
- group :development, :test do
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 "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "activerecord", "~> 5.2"
3
+ gem 'activerecord', '~> 5.2.0'
4
4
 
5
- group :development, :test do
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 "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "activerecord", "~> 6"
3
+ gem 'activerecord', '~> 6.0.0'
4
4
 
5
- group :development, :test do
6
- gem "bundler"
7
- gem "rake"
8
- gem "minitest"
9
- gem "sqlite3"
10
- end
11
-
12
- gemspec :path => "../"
5
+ gemspec path: '../'
@@ -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.0'
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,14 @@
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.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: 2022-03-21 00:00:00.000000000 Z
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.0.9
129
+ rubygems_version: 3.5.16
127
130
  signing_key:
128
131
  specification_version: 4
129
132
  summary: Bit array for ActiveRecord
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