bitwise_attribute 0.3.4 → 0.3.5

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: a19184eaf7a73f44c929b1aa3cb0794d2d4be1f54a5c15802e1cd1eb0edf1641
4
- data.tar.gz: 03edbbb6992ec20733a349a7eefc7b776a4fa91c74e1373222b8949298bbc07f
3
+ metadata.gz: df49609ab57b88fb77568ae2cdc29ee9851626a67e632170e9a90ebae1bbbfdb
4
+ data.tar.gz: c5271b2e9ef62d0a6e1e1e55bddc3eaa63274d775065618077fe78299774fcae
5
5
  SHA512:
6
- metadata.gz: 9159f1439b717c6f4954ed5582d8811d4da7b37b3375ca1cfe4899760d94e5ca189f889180a5465a4b2dc18f7073aed55cfafb852acfce6c93d628088729c784
7
- data.tar.gz: 2a2c1f64d74e7184c23d403f48b76566e34db91b2d1e081c70effad74394d4fb7e328c058cdadf6ec4945f4180ce6bedf7c2d2ffcabec69ef2890aee3b28ff10
6
+ metadata.gz: 64de0ef4cef8fcec575b2c31e04350282c0b5c45c87d2ef87e2a174c13f80cbb2bbafe06e273c189ace9650123b1e4d7f5ff9bd999c1086d2866dbea06bd409f
7
+ data.tar.gz: bf54560552fdfbf62753044fe65507c405d81240733317e6200cf0417347161aa618cfeddf347d689bdf233917109c5e1d9a51d651c1f32eddd52668a1ea796c
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ .DS_Store
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitwise_attribute (0.3.4)
4
+ bitwise_attribute (0.3.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activemodel (6.1.3.2)
10
- activesupport (= 6.1.3.2)
11
- activerecord (6.1.3.2)
12
- activemodel (= 6.1.3.2)
13
- activesupport (= 6.1.3.2)
14
- activesupport (6.1.3.2)
9
+ activemodel (6.1.4.1)
10
+ activesupport (= 6.1.4.1)
11
+ activerecord (6.1.4.1)
12
+ activemodel (= 6.1.4.1)
13
+ activesupport (= 6.1.4.1)
14
+ activesupport (6.1.4.1)
15
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
16
  i18n (>= 1.6, < 2)
17
17
  minitest (>= 5.1)
@@ -20,16 +20,16 @@ GEM
20
20
  ast (2.4.2)
21
21
  byebug (11.1.3)
22
22
  coderay (1.1.3)
23
- concurrent-ruby (1.1.8)
23
+ concurrent-ruby (1.1.9)
24
24
  diff-lcs (1.4.4)
25
25
  docile (1.4.0)
26
- ffi (1.15.1-java)
26
+ ffi (1.15.4-java)
27
27
  i18n (1.8.10)
28
28
  concurrent-ruby (~> 1.0)
29
29
  method_source (1.0.0)
30
30
  minitest (5.14.4)
31
- parallel (1.20.1)
32
- parser (3.0.1.1)
31
+ parallel (1.21.0)
32
+ parser (3.0.2.0)
33
33
  ast (~> 2.4.1)
34
34
  pry (0.13.1)
35
35
  coderay (~> 1.1)
@@ -42,7 +42,7 @@ GEM
42
42
  byebug (~> 11.0)
43
43
  pry (~> 0.13.0)
44
44
  rainbow (3.0.0)
45
- rake (13.0.3)
45
+ rake (13.0.6)
46
46
  regexp_parser (2.1.1)
47
47
  rexml (3.2.5)
48
48
  rspec (3.10.0)
@@ -58,22 +58,21 @@ GEM
58
58
  diff-lcs (>= 1.2.0, < 2.0)
59
59
  rspec-support (~> 3.10.0)
60
60
  rspec-support (3.10.2)
61
- rubocop (1.15.0)
61
+ rubocop (1.22.1)
62
62
  parallel (~> 1.10)
63
63
  parser (>= 3.0.0.0)
64
64
  rainbow (>= 2.2.2, < 4.0)
65
65
  regexp_parser (>= 1.8, < 3.0)
66
66
  rexml
67
- rubocop-ast (>= 1.5.0, < 2.0)
67
+ rubocop-ast (>= 1.12.0, < 2.0)
68
68
  ruby-progressbar (~> 1.7)
69
69
  unicode-display_width (>= 1.4.0, < 3.0)
70
- rubocop-ast (1.7.0)
70
+ rubocop-ast (1.12.0)
71
71
  parser (>= 3.0.1.1)
72
- rubocop-rake (0.5.1)
73
- rubocop
74
- rubocop-rspec (2.3.0)
72
+ rubocop-rake (0.6.0)
75
73
  rubocop (~> 1.0)
76
- rubocop-ast (>= 1.1.0)
74
+ rubocop-rspec (2.5.0)
75
+ rubocop (~> 1.19)
77
76
  ruby-progressbar (1.11.0)
78
77
  simplecov (0.21.2)
79
78
  docile (~> 1.1)
@@ -86,7 +85,7 @@ GEM
86
85
  sqlite3 (1.4.2)
87
86
  tzinfo (2.0.4)
88
87
  concurrent-ruby (~> 1.0)
89
- unicode-display_width (2.0.0)
88
+ unicode-display_width (2.1.0)
90
89
  zeitwerk (2.4.2)
91
90
 
92
91
  PLATFORMS
@@ -6,12 +6,12 @@ module BitwiseAttribute
6
6
  define_singleton_method("with_#{name}") do |*keys|
7
7
  keys = cleanup_keys(keys, mapping)
8
8
 
9
- return [] unless keys&.any?
9
+ return none unless keys&.any?
10
10
 
11
- records = where("#{column_name} & #{mapping[keys.first]} = #{mapping[keys.first]}")
11
+ records = all
12
12
 
13
- keys[1..-1].each do |key|
14
- records = records.where("#{column_name} & #{mapping[key]} = #{mapping[key]}")
13
+ keys.each do |key|
14
+ records = records.where((arel_table[column_name] & mapping[key]).eq(mapping[key]))
15
15
  end
16
16
 
17
17
  records
@@ -22,10 +22,10 @@ module BitwiseAttribute
22
22
 
23
23
  return where.not(column_name => nil) unless keys&.any?
24
24
 
25
- records = where("#{column_name} & #{mapping[keys.first]} = #{mapping[keys.first]}")
25
+ records = where('1=0')
26
26
 
27
- keys[1..-1].each do |key|
28
- records = records.or(where("#{column_name} & #{mapping[key]} = #{mapping[key]}"))
27
+ keys.each do |key|
28
+ records = records.or(where((arel_table[column_name] & mapping[key]).eq(mapping[key])))
29
29
  end
30
30
 
31
31
  records
@@ -34,12 +34,12 @@ module BitwiseAttribute
34
34
  define_singleton_method("with_exact_#{name}") do |*keys|
35
35
  keys = cleanup_keys(keys, mapping)
36
36
 
37
- return [] unless keys&.any?
37
+ return none unless keys&.any?
38
38
 
39
39
  records = send("with_#{name}", keys)
40
40
 
41
41
  (mapping.keys - keys).each do |key|
42
- records = records.where("#{column_name} & #{mapping[key]} != #{mapping[key]}")
42
+ records = records.where((arel_table[column_name] & mapping[key]).not_eq(mapping[key]))
43
43
  end
44
44
 
45
45
  records
@@ -50,10 +50,10 @@ module BitwiseAttribute
50
50
 
51
51
  return where(column_name => nil).or(where(column_name => 0)) unless keys&.any?
52
52
 
53
- records = where("#{column_name} & #{mapping[keys.first]} != #{mapping[keys.first]}")
53
+ records = all
54
54
 
55
- keys[1..-1].each do |key|
56
- records = records.where("#{column_name} & #{mapping[key]} != #{mapping[key]}")
55
+ keys.each do |key|
56
+ records = records.where((arel_table[column_name] & mapping[key]).not_eq(mapping[key]))
57
57
  end
58
58
 
59
59
  records
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BitwiseAttribute
4
- VERSION = '0.3.4'
4
+ VERSION = '0.3.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitwise_attribute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-29 00:00:00.000000000 Z
11
+ date: 2021-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord