tag_columns 0.1.5 → 0.1.6

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: 24f11ec231a99f562784740d0fac6e7cff7c5d83
4
- data.tar.gz: 07711c4b518ebc23d2204745a10612f4b2ffa7a5
3
+ metadata.gz: 7ff5c636e80445d9004a6a73f81bb00c2759bd52
4
+ data.tar.gz: cc7a8f4f24b8c444cca1d505bd2c20d0c536271c
5
5
  SHA512:
6
- metadata.gz: 31d75863702077cfd2d87cd1ebd96feaab89beafbc3057b527196c8f3c1a2f106de80deb9c0a79581ad28df849a0bf3d2054f0a10178c466a877949718264449
7
- data.tar.gz: 4bc98eab66d115fb8caf0f91c9a892d1c539f28e7f0c9a7b22763d2948b3bd01940bd1c4cdfff76a7f43f08cfc1ddd6156ba353cacc44001a76457089f2b04d4
6
+ metadata.gz: b94d8debbfc4bebd2dfd6ccfb2e42e0b28f8c31473bc089b37c488fef2e91f065bc26e9334390ffd101465255e4103b848c3c11271694482b765cb6aa9c051ef
7
+ data.tar.gz: 5da5092f088610e1cc9bcb7d166ddf187a049037ce66f2d0b7ef80d64096cbef95e14f1024c881f619dacd5230b734aca9142dcdce40bf0d1ed0fc234f206292
data/Gemfile.lock CHANGED
@@ -1,18 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tag_columns (0.1.5)
4
+ tag_columns (0.1.6)
5
5
  activesupport
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (5.1.4)
10
+ activesupport (5.1.5)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
12
  i18n (~> 0.7)
13
13
  minitest (~> 5.1)
14
14
  tzinfo (~> 1.1)
15
- ast (2.3.0)
16
15
  binding_of_caller (0.7.2)
17
16
  debug_inspector (>= 0.0.1)
18
17
  byebug (9.0.6)
@@ -26,15 +25,13 @@ GEM
26
25
  tins (~> 1.6)
27
26
  debug_inspector (0.0.2)
28
27
  docile (1.1.5)
29
- i18n (0.8.6)
28
+ i18n (0.9.5)
29
+ concurrent-ruby (~> 1.0)
30
30
  interception (0.5)
31
31
  json (2.0.4)
32
32
  method_source (0.8.2)
33
- minitest (5.10.3)
33
+ minitest (5.11.3)
34
34
  os (1.0.0)
35
- parser (2.4.0.0)
36
- ast (~> 2.2)
37
- powerpack (0.1.1)
38
35
  pry (0.10.4)
39
36
  coderay (~> 1.1.0)
40
37
  method_source (~> 0.8.1)
@@ -54,15 +51,7 @@ GEM
54
51
  pry-byebug
55
52
  pry-rescue
56
53
  pry-stack_explorer
57
- rainbow (2.2.1)
58
54
  rake (12.0.0)
59
- rubocop (0.48.1)
60
- parser (>= 2.3.3.1, < 3.0)
61
- powerpack (~> 0.1)
62
- rainbow (>= 1.99.1, < 3.0)
63
- ruby-progressbar (~> 1.7)
64
- unicode-display_width (~> 1.0, >= 1.0.1)
65
- ruby-progressbar (1.8.1)
66
55
  simplecov (0.14.1)
67
56
  docile (~> 1.1.0)
68
57
  json (>= 1.8, < 3)
@@ -74,9 +63,8 @@ GEM
74
63
  thor (0.19.4)
75
64
  thread_safe (0.3.6)
76
65
  tins (1.13.2)
77
- tzinfo (1.2.3)
66
+ tzinfo (1.2.5)
78
67
  thread_safe (~> 0.1)
79
- unicode-display_width (1.2.1)
80
68
 
81
69
  PLATFORMS
82
70
  ruby
@@ -85,8 +73,7 @@ DEPENDENCIES
85
73
  coveralls
86
74
  pry-test
87
75
  rake
88
- rubocop
89
76
  tag_columns!
90
77
 
91
78
  BUNDLED WITH
92
- 1.15.4
79
+ 1.16.0
data/README.md CHANGED
@@ -1,16 +1,13 @@
1
1
  [![Lines of Code](http://img.shields.io/badge/lines_of_code-53-brightgreen.svg?style=flat)](http://blog.codinghorror.com/the-best-code-is-no-code-at-all/)
2
- [![Code Status](http://img.shields.io/codeclimate/github/hopsoft/tag_columns.svg?style=flat)](https://codeclimate.com/github/hopsoft/tag_columns)
2
+ [![Maintainability](https://api.codeclimate.com/v1/badges/7503486b1bb494b5d976/maintainability)](https://codeclimate.com/github/hopsoft/tag_columns/maintainability)
3
3
  [![Dependency Status](http://img.shields.io/gemnasium/hopsoft/tag_columns.svg?style=flat)](https://gemnasium.com/hopsoft/tag_columns)
4
4
  [![Build Status](http://img.shields.io/travis/hopsoft/tag_columns.svg?style=flat)](https://travis-ci.org/hopsoft/tag_columns)
5
5
  [![Coverage Status](https://img.shields.io/coveralls/hopsoft/tag_columns.svg?style=flat)](https://coveralls.io/r/hopsoft/tag_columns?branch=master)
6
6
  [![Downloads](http://img.shields.io/gem/dt/tag_columns.svg?style=flat)](http://rubygems.org/gems/tag_columns)
7
7
 
8
- [![Sponsor](https://app.codesponsor.io/embed/QMSjMHrtPhvfmCnk5Hbikhhr/hopsoft/tag_columns.svg)](https://app.codesponsor.io/link/QMSjMHrtPhvfmCnk5Hbikhhr/hopsoft/tag_columns)
9
-
10
8
  # TagColumns
11
9
 
12
10
  Fast & simple Rails ActiveRecord model tagging using [PostgreSQL's](https://www.postgresql.org/) [Array datatype](https://www.postgresql.org/docs/current/static/arrays.html).
13
-
14
11
  *Similar to [acts_as_taggable_on](https://github.com/mbleigh/acts-as-taggable-on) but lighter weight with fewer features.*
15
12
  *Also, be sure to check out [acts_as_taggable_array_on](https://github.com/tmiyamon/acts-as-taggable-array-on).*
16
13
 
@@ -61,6 +58,8 @@ is_reader_or_writer = user.has_any_groups?(:reader, :writer)
61
58
  is_reader_and_writer = user.has_all_groups?(:reader, :writer)
62
59
 
63
60
  # finding tagged records
61
+ assigned = User.with_groups
62
+ unassigned = User.without_groups
64
63
  writers = User.with_any_groups(:writer)
65
64
  non_writers = User.without_any_groups(:writer)
66
65
  readers_or_writers = User.with_any_groups(:reader, :writer)
@@ -1,3 +1,3 @@
1
1
  module TagColumns
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/tag_columns.rb CHANGED
@@ -35,6 +35,8 @@ module TagColumns
35
35
  result.values.flatten
36
36
  end
37
37
 
38
+ scope :"with_#{method_name}", -> { where("#{quoted_column_name}::text[] IS NOT NULL").where("#{quoted_column_name}::text[] != '{}'") }
39
+ scope :"without_#{method_name}", -> { where("#{quoted_column_name}::text[] IS NULL").or where("#{quoted_column_name}::text[] = '{}'") }
38
40
  scope :"with_any_#{method_name}", ->(*tags) { where "#{quoted_column_name}::text[] && ARRAY[?]::text[]", tag_columns_sanitize_list(tags) }
39
41
  scope :"with_all_#{method_name}", ->(*tags) { where "#{quoted_column_name}::text[] @> ARRAY[?]::text[]", tag_columns_sanitize_list(tags) }
40
42
  scope :"without_any_#{method_name}", ->(*tags) { where.not "#{quoted_column_name}::text[] && ARRAY[?]::text[]", tag_columns_sanitize_list(tags) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tag_columns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-09 00:00:00.000000000 Z
11
+ date: 2018-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  description:
84
70
  email:
85
71
  - natehop@gmail.com