bitfields 0.12.1 → 0.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4067949c427d33aea4273d215c2e2bc7d05c326a
4
- data.tar.gz: eb2c0e014d2c94d2b1e4bd0298c3187e983187a0
3
+ metadata.gz: fa18acfa732a68288db8c56fc05ccfae55530be9
4
+ data.tar.gz: 1a23e528932a1e8d1873ec8ec9a707a6c3dc000d
5
5
  SHA512:
6
- metadata.gz: aa11c11730842bf735a7985d080eff98ff880a9271636986a964d4b1d6f1d1e397a6570c0b3d66651a41153af6e79c61a818c0cea3e2a7b5c3c44276024e9f36
7
- data.tar.gz: e079d294a34cb6ed4f0ec3c2d5d099fdfaafa09f1eafbc6e7958d85d76f6190a34cc9d8f42b45332146f89e4bf795e268f6c6ef1705a5386cf40eeef1ae3dc2c
6
+ metadata.gz: 0c14625d4af510f6789978ad7b872cb4b300e08efeb8af4d03b235086afb5dcce677f03a242f051987011f9b38750416b6e1fd00d934ba9a538acd97c275ae7c
7
+ data.tar.gz: b7f9579b08062e2e140272f8942c4a659a9a22e2610d3987df6211c4b0c37d2d10cc469c2de56cdc6d99ef8eeb078e70ca013d967adb5518b2e3caa9de3c118f
data/Readme.md CHANGED
@@ -154,6 +154,7 @@ Authors
154
154
  - [Alan Wong](https://github.com/naganowl)
155
155
  - [Andrew Bates](https://github.com/a-bates)
156
156
  - [Shirish Pampoorickal](https://github.com/shirish-pampoorickal)
157
+ - [Sergey Kojin](https://github.com/skojin)
157
158
 
158
159
  [Michael Grosser](http://grosser.it)<br/>
159
160
  michael@grosser.it<br/>
@@ -140,12 +140,10 @@ module Bitfields
140
140
  on, off = bit_values_to_on_off(column, bit_values)
141
141
  "(#{table_name}.#{column} & #{on+off}) = #{on}"
142
142
  when :bit_operator_or
143
+ on, off = bit_values_to_on_off(column, bit_values)
143
144
  result = []
144
- bit_values.each do |bit_name, value|
145
- bit = bitfields[column][bit_name]
146
- eql = value ? bit : 0
147
- result << "(#{table_name}.#{column} & #{bit}) = #{eql}"
148
- end
145
+ result << "(#{table_name}.#{column} & #{on}) <> 0" if on != 0
146
+ result << "(#{table_name}.#{column} & #{off}) <> #{off}" if off != 0
149
147
  result.join(' OR ')
150
148
  else raise("bitfields: unknown query mode #{mode.inspect}")
151
149
  end
@@ -1,3 +1,3 @@
1
1
  module Bitfields
2
- Version = VERSION = "0.12.1"
2
+ Version = VERSION = "0.13.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-17 00:00:00.000000000 Z
11
+ date: 2019-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord