bitwise_attribute 0.3.3 → 0.3.4

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: edc8d43a0b14e79d054f640818259e8b1319c0e03c0298e0b30a945af8806c5a
4
- data.tar.gz: fcd3223fdb12a3c3a6e88def6ef532a7408c2da995ba69da8cd697fd5e973a57
3
+ metadata.gz: a19184eaf7a73f44c929b1aa3cb0794d2d4be1f54a5c15802e1cd1eb0edf1641
4
+ data.tar.gz: 03edbbb6992ec20733a349a7eefc7b776a4fa91c74e1373222b8949298bbc07f
5
5
  SHA512:
6
- metadata.gz: 102e858e4fcabc19446bea8ef839543a5bdc3b37bb09ba5363bdfb4685667e71f6a784d8c61f33facf8f12525839d4fafd38f65b8bf41dfaf7a60389596926a9
7
- data.tar.gz: 7beacff8966e4b4f27ba801c0989d11e2d93975b5c4ac2958f63d797cafdd68fa0d3433273feb89cd29fdcaec5b255312c1e23e37dc5297e8808ebe12e5362e4
6
+ metadata.gz: 9159f1439b717c6f4954ed5582d8811d4da7b37b3375ca1cfe4899760d94e5ca189f889180a5465a4b2dc18f7073aed55cfafb852acfce6c93d628088729c784
7
+ data.tar.gz: 2a2c1f64d74e7184c23d403f48b76566e34db91b2d1e081c70effad74394d4fb7e328c058cdadf6ec4945f4180ce6bedf7c2d2ffcabec69ef2890aee3b28ff10
@@ -0,0 +1,41 @@
1
+
2
+ name: CI
3
+
4
+ on: [push, pull_request]
5
+
6
+ jobs:
7
+ lint:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: "2.5"
14
+ bundler-cache: true
15
+ - name: rubocop version
16
+ timeout-minutes: 1
17
+ run: bundle exec rubocop --version
18
+ - name: rubocop
19
+ timeout-minutes: 5
20
+ run: bundle exec rubocop -c .rubocop.yml
21
+
22
+ test:
23
+ runs-on: ubuntu-latest
24
+ continue-on-error: ${{ matrix.experimental }}
25
+ strategy:
26
+ fail-fast: false
27
+ matrix:
28
+ ruby: ["2.5", "2.6", "2.7", "3.0"]
29
+ experimental: [false]
30
+ include:
31
+ - ruby: "truffleruby"
32
+ experimental: true
33
+ steps:
34
+ - uses: actions/checkout@v2
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{matrix.ruby}}
38
+ bundler-cache: true
39
+ - name: Run tests
40
+ timeout-minutes: 5
41
+ run: ${{matrix.env}} bundle exec rspec
data/.rubocop.yml CHANGED
@@ -1,12 +1,26 @@
1
- Metrics/AbcSize:
2
- Max: 30
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ NewCops: enable
7
+ TargetRubyVersion: 2.5
8
+
9
+ RSpec/MultipleMemoizedHelpers:
10
+ Max: 10
3
11
 
4
12
  Style/Documentation:
5
13
  Enabled: false
6
14
 
7
- Metrics/LineLength:
15
+ Layout/LineLength:
8
16
  Max: 100
9
17
 
18
+ Metrics/CyclomaticComplexity:
19
+ Max: 15
20
+
21
+ Metrics/PerceivedComplexity:
22
+ Max: 15
23
+
10
24
  Metrics/MethodLength:
11
25
  Max: 50
12
26
 
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.7.2
data/Gemfile.lock CHANGED
@@ -1,91 +1,111 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitwise_attribute (0.3.3)
4
+ bitwise_attribute (0.3.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activemodel (5.1.5)
10
- activesupport (= 5.1.5)
11
- activerecord (5.1.5)
12
- activemodel (= 5.1.5)
13
- activesupport (= 5.1.5)
14
- arel (~> 8.0)
15
- activesupport (5.1.5)
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)
16
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (~> 0.7)
18
- minitest (~> 5.1)
19
- tzinfo (~> 1.1)
20
- arel (8.0.0)
21
- ast (2.4.0)
22
- byebug (10.0.1)
23
- coderay (1.1.2)
24
- concurrent-ruby (1.0.5)
25
- diff-lcs (1.3)
26
- docile (1.1.5)
27
- i18n (0.9.5)
16
+ i18n (>= 1.6, < 2)
17
+ minitest (>= 5.1)
18
+ tzinfo (~> 2.0)
19
+ zeitwerk (~> 2.3)
20
+ ast (2.4.2)
21
+ byebug (11.1.3)
22
+ coderay (1.1.3)
23
+ concurrent-ruby (1.1.8)
24
+ diff-lcs (1.4.4)
25
+ docile (1.4.0)
26
+ ffi (1.15.1-java)
27
+ i18n (1.8.10)
28
28
  concurrent-ruby (~> 1.0)
29
- json (2.1.0)
30
- method_source (0.9.0)
31
- minitest (5.11.3)
32
- parallel (1.12.1)
33
- parser (2.5.0.5)
34
- ast (~> 2.4.0)
35
- powerpack (0.1.1)
36
- pry (0.11.3)
37
- coderay (~> 1.1.0)
38
- method_source (~> 0.9.0)
39
- pry-byebug (3.6.0)
40
- byebug (~> 10.0)
41
- pry (~> 0.10)
29
+ method_source (1.0.0)
30
+ minitest (5.14.4)
31
+ parallel (1.20.1)
32
+ parser (3.0.1.1)
33
+ ast (~> 2.4.1)
34
+ pry (0.13.1)
35
+ coderay (~> 1.1)
36
+ method_source (~> 1.0)
37
+ pry (0.13.1-java)
38
+ coderay (~> 1.1)
39
+ method_source (~> 1.0)
40
+ spoon (~> 0.0)
41
+ pry-byebug (3.9.0)
42
+ byebug (~> 11.0)
43
+ pry (~> 0.13.0)
42
44
  rainbow (3.0.0)
43
- rake (10.5.0)
44
- rspec (3.7.0)
45
- rspec-core (~> 3.7.0)
46
- rspec-expectations (~> 3.7.0)
47
- rspec-mocks (~> 3.7.0)
48
- rspec-core (3.7.1)
49
- rspec-support (~> 3.7.0)
50
- rspec-expectations (3.7.0)
45
+ rake (13.0.3)
46
+ regexp_parser (2.1.1)
47
+ rexml (3.2.5)
48
+ rspec (3.10.0)
49
+ rspec-core (~> 3.10.0)
50
+ rspec-expectations (~> 3.10.0)
51
+ rspec-mocks (~> 3.10.0)
52
+ rspec-core (3.10.1)
53
+ rspec-support (~> 3.10.0)
54
+ rspec-expectations (3.10.1)
51
55
  diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.7.0)
53
- rspec-mocks (3.7.0)
56
+ rspec-support (~> 3.10.0)
57
+ rspec-mocks (3.10.2)
54
58
  diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.7.0)
56
- rspec-support (3.7.1)
57
- rubocop (0.54.0)
59
+ rspec-support (~> 3.10.0)
60
+ rspec-support (3.10.2)
61
+ rubocop (1.15.0)
58
62
  parallel (~> 1.10)
59
- parser (>= 2.5)
60
- powerpack (~> 0.1)
63
+ parser (>= 3.0.0.0)
61
64
  rainbow (>= 2.2.2, < 4.0)
65
+ regexp_parser (>= 1.8, < 3.0)
66
+ rexml
67
+ rubocop-ast (>= 1.5.0, < 2.0)
62
68
  ruby-progressbar (~> 1.7)
63
- unicode-display_width (~> 1.0, >= 1.0.1)
64
- ruby-progressbar (1.9.0)
65
- simplecov (0.15.1)
66
- docile (~> 1.1.0)
67
- json (>= 1.8, < 3)
68
- simplecov-html (~> 0.10.0)
69
- simplecov-html (0.10.2)
70
- sqlite3 (1.3.13)
71
- thread_safe (0.3.6)
72
- tzinfo (1.2.5)
73
- thread_safe (~> 0.1)
74
- unicode-display_width (1.3.0)
69
+ unicode-display_width (>= 1.4.0, < 3.0)
70
+ rubocop-ast (1.7.0)
71
+ parser (>= 3.0.1.1)
72
+ rubocop-rake (0.5.1)
73
+ rubocop
74
+ rubocop-rspec (2.3.0)
75
+ rubocop (~> 1.0)
76
+ rubocop-ast (>= 1.1.0)
77
+ ruby-progressbar (1.11.0)
78
+ simplecov (0.21.2)
79
+ docile (~> 1.1)
80
+ simplecov-html (~> 0.11)
81
+ simplecov_json_formatter (~> 0.1)
82
+ simplecov-html (0.12.3)
83
+ simplecov_json_formatter (0.1.3)
84
+ spoon (0.0.6)
85
+ ffi
86
+ sqlite3 (1.4.2)
87
+ tzinfo (2.0.4)
88
+ concurrent-ruby (~> 1.0)
89
+ unicode-display_width (2.0.0)
90
+ zeitwerk (2.4.2)
75
91
 
76
92
  PLATFORMS
77
- ruby
93
+ universal-java-11
94
+ x86_64-darwin-19
95
+ x86_64-linux
78
96
 
79
97
  DEPENDENCIES
80
98
  activerecord (>= 3)
81
99
  bitwise_attribute!
82
- bundler (~> 1.16)
100
+ bundler
83
101
  pry-byebug
84
- rake (~> 10.0)
85
- rspec (~> 3.0)
86
- rubocop (~> 0.54.0)
87
- simplecov (~> 0.15.1)
102
+ rake
103
+ rspec
104
+ rubocop
105
+ rubocop-rake
106
+ rubocop-rspec
107
+ simplecov
88
108
  sqlite3
89
109
 
90
110
  BUNDLED WITH
91
- 1.16.1
111
+ 2.2.16
data/README.md CHANGED
@@ -1,6 +1,3 @@
1
- [![Dependency Status](https://gemnasium.com/rikas/bitwise_attribute.svg)](https://gemnasium.com/rikas/bitwise_attribute)
2
- [![Build Status](https://travis-ci.org/rikas/bitwise_attribute.svg?branch=master)](https://travis-ci.org/rikas/bitwise_attribute)
3
-
4
1
  # BitwiseAttribute
5
2
  Manipulation of bitmask attributes in your classes (typically ActiveRecord models). You can have multiple values mapped to the same column — for example when you need a User with multiple roles.
6
3
 
@@ -44,7 +41,7 @@ end
44
41
  ```ruby
45
42
  class User < ActiveRecord::Base
46
43
  include BitwiseAttribute
47
-
44
+
48
45
  # This line will do all the magic!
49
46
  #
50
47
  # By default we assume that your column will be called `role_mask`.
@@ -7,6 +7,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
7
  require 'bitwise_attribute/version'
8
8
 
9
9
  Gem::Specification.new do |spec|
10
+ spec.required_ruby_version = '>= 2.5.0'
10
11
  spec.name = 'bitwise_attribute'
11
12
  spec.version = BitwiseAttribute::VERSION
12
13
  spec.authors = ['Ricardo Otero']
@@ -25,11 +26,13 @@ Gem::Specification.new do |spec|
25
26
  spec.require_paths = %w[lib]
26
27
 
27
28
  spec.add_development_dependency 'activerecord', '>= 3'
28
- spec.add_development_dependency 'bundler', '~> 1.16'
29
+ spec.add_development_dependency 'bundler'
29
30
  spec.add_development_dependency 'pry-byebug'
30
- spec.add_development_dependency 'rake', '~> 10.0'
31
- spec.add_development_dependency 'rspec', '~> 3.0'
32
- spec.add_development_dependency 'rubocop', '~> 0.54.0'
33
- spec.add_development_dependency 'simplecov', '~> 0.15.1'
31
+ spec.add_development_dependency 'rake'
32
+ spec.add_development_dependency 'rspec'
33
+ spec.add_development_dependency 'rubocop'
34
+ spec.add_development_dependency 'rubocop-rake'
35
+ spec.add_development_dependency 'rubocop-rspec'
36
+ spec.add_development_dependency 'simplecov'
34
37
  spec.add_development_dependency 'sqlite3'
35
38
  end
@@ -16,7 +16,7 @@ module BitwiseAttribute
16
16
  module ClassMethods
17
17
  include BitwiseAttribute::ActiveRecordMethods
18
18
 
19
- def attr_bitwise(name, column_name: nil, values:)
19
+ def attr_bitwise(name, values:, column_name: nil)
20
20
  column_name ||= "#{name.to_s.singularize}_mask"
21
21
 
22
22
  mapping = build_mapping(values)
@@ -48,7 +48,7 @@ module BitwiseAttribute
48
48
  end
49
49
 
50
50
  # Adds a boolean method for each key (ex: admin?)
51
- mapping.keys.each do |key|
51
+ mapping.each_key do |key|
52
52
  define_method("#{key}?") do
53
53
  value?(column_name, mapping[key])
54
54
  end
@@ -61,7 +61,7 @@ module BitwiseAttribute
61
61
 
62
62
  # Defines a class method for each key of the mapping, returning records that have *at least*
63
63
  # the corresponding value.
64
- mapping.keys.each do |key|
64
+ mapping.each_key do |key|
65
65
  define_singleton_method(key) do
66
66
  send("with_#{name}", key)
67
67
  end
@@ -3,10 +3,10 @@
3
3
  module BitwiseAttribute
4
4
  class ValuesList < Array
5
5
  def initialize(field, record, values)
6
+ super(concat(values))
7
+
6
8
  @field = field
7
9
  @record = record
8
-
9
- concat(values)
10
10
  end
11
11
 
12
12
  def <<(value)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BitwiseAttribute
4
- VERSION = '0.3.3'
4
+ VERSION = '0.3.4'
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.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-31 00:00:00.000000000 Z
11
+ date: 2021-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.16'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.16'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry-byebug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,58 +56,86 @@ dependencies:
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.54.0
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.54.0
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: simplecov
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
- - - "~>"
129
+ - - ">="
102
130
  - !ruby/object:Gem::Version
103
- version: 0.15.1
131
+ version: '0'
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
- - - "~>"
136
+ - - ">="
109
137
  - !ruby/object:Gem::Version
110
- version: 0.15.1
138
+ version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: sqlite3
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -129,11 +157,11 @@ executables: []
129
157
  extensions: []
130
158
  extra_rdoc_files: []
131
159
  files:
160
+ - ".github/workflows/ci.yml"
132
161
  - ".gitignore"
133
162
  - ".rspec"
134
163
  - ".rubocop.yml"
135
164
  - ".ruby-version"
136
- - ".travis.yml"
137
165
  - Gemfile
138
166
  - Gemfile.lock
139
167
  - LICENSE.txt
@@ -150,7 +178,7 @@ homepage: https://github.com/rikas/bitwise_attribute
150
178
  licenses:
151
179
  - MIT
152
180
  metadata: {}
153
- post_install_message:
181
+ post_install_message:
154
182
  rdoc_options: []
155
183
  require_paths:
156
184
  - lib
@@ -158,16 +186,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
186
  requirements:
159
187
  - - ">="
160
188
  - !ruby/object:Gem::Version
161
- version: '0'
189
+ version: 2.5.0
162
190
  required_rubygems_version: !ruby/object:Gem::Requirement
163
191
  requirements:
164
192
  - - ">="
165
193
  - !ruby/object:Gem::Version
166
194
  version: '0'
167
195
  requirements: []
168
- rubyforge_project:
169
- rubygems_version: 2.7.3
170
- signing_key:
196
+ rubygems_version: 3.1.4
197
+ signing_key:
171
198
  specification_version: 4
172
199
  summary: Bitwise attribute for ruby class and Rails model.
173
200
  test_files: []
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler -v 1.16.1
6
- script:
7
- - bundle exec rspec --fail-fast
8
- - bundle exec rubocop