bitwise_attribute 0.3.0 → 0.3.1

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: '09a20c421bbc1d6c4c7803c43be1b937f53725c9f9cea4be27c05c0c00b4d23a'
4
- data.tar.gz: 15af80b8780cfa9e081c45186049ee7bbd9a96266f140fcf2294e14adadf8dcc
3
+ metadata.gz: 0f0f237297a8e24d935ba7d8a1e527be90905ce307bb0969f4da05f865ccf620
4
+ data.tar.gz: a8759597c78d19d75ffac48269501fd8dfe7aa9d382c55324ef36b22557b74e6
5
5
  SHA512:
6
- metadata.gz: 8bbf57d1f5e5a69a2ab6952ca9d8cf5376e28846e8ab2b7d0c858d9838bf7d6563e6ceb283b8641b0095e2dc05150a17aa60bdafaad8c872c775bf967d4b9c61
7
- data.tar.gz: 90a8b4ca18833063b57d64279ef2e2c8bef0c2a7975788c128dbf31fca0a4b3535a6820955a6e0e42412e4afb3f98a7db8e18549d8f5cfc93f16c5b66406fb24
6
+ metadata.gz: cb1e364a63825b238ecd8c5c2fc45d52017544039b858cea80b8f2609104f19b90f974bbd2aaeff28b33589b8e1173a8b391ca5396ccc68d4d7f118db1461160
7
+ data.tar.gz: ebca18a680d5b87ad721f626ad7cf7cbc3bb362d98845fc3d9144c4bdd70b3a2c8e3b5cdd867660e53ffaf4980b7a72a0c0518da9133afb43eb35673e7db0397
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitwise_attribute (0.3.0)
4
+ bitwise_attribute (0.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -4,7 +4,7 @@ module BitwiseAttribute
4
4
  module ActiveRecordMethods
5
5
  def define_named_scopes(name, column_name, mapping)
6
6
  define_singleton_method("with_#{name}") do |*keys|
7
- keys = keys.flatten.uniq
7
+ keys = cleanup_keys(keys)
8
8
 
9
9
  return [] unless keys&.any?
10
10
 
@@ -18,7 +18,7 @@ module BitwiseAttribute
18
18
  end
19
19
 
20
20
  define_singleton_method("with_any_#{name}") do |*keys|
21
- keys = keys.flatten.uniq
21
+ keys = cleanup_keys(keys)
22
22
 
23
23
  return where.not(column_name => nil) unless keys&.any?
24
24
 
@@ -32,7 +32,7 @@ module BitwiseAttribute
32
32
  end
33
33
 
34
34
  define_singleton_method("with_exact_#{name}") do |*keys|
35
- keys = keys.flatten.uniq
35
+ keys = cleanup_keys(keys)
36
36
 
37
37
  return [] unless keys&.any?
38
38
 
@@ -46,7 +46,7 @@ module BitwiseAttribute
46
46
  end
47
47
 
48
48
  define_singleton_method("without_#{name}") do |*keys|
49
- keys = keys.flatten.uniq
49
+ keys = cleanup_keys(keys)
50
50
 
51
51
  return where(column_name => nil).or(where(column_name => 0)) unless keys&.any?
52
52
 
@@ -67,5 +67,11 @@ module BitwiseAttribute
67
67
  end
68
68
  end
69
69
  end
70
+
71
+ def cleanup_keys(keys)
72
+ return [] unless keys
73
+
74
+ keys.flatten.map(&:to_sym).uniq
75
+ end
70
76
  end
71
77
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BitwiseAttribute
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitwise_attribute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero