tag_columns 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +60 -28
- data/README.md +1 -1
- data/bin/standardize +3 -0
- data/lib/tag_columns.rb +13 -4
- data/lib/tag_columns/version.rb +1 -1
- data/tag_columns.gemspec +21 -0
- metadata +23 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bb5849e125d7d342653151b9376d43d904867a31c05df4716efde6f7a91d608
|
4
|
+
data.tar.gz: 55a5b086ac67b2cde68c7befd6707d084d49e388357a940d21e1500d764c8a2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6fc69ae96f44815701774dee9b58fb72d51080c0c5930ddefa1cd2ee14a9ac444374cf1939b5a7133fdd56341a6be6c9410892476b6f6e83ee29c90c6115436
|
7
|
+
data.tar.gz: 46f4f957e0f95c4d4177345f7bcffa3ce46416f3d9a6d93eb47e4e6c619dabe423a32ab31e0e5fcaddeb1a7f71314f37d107f99e63643c550ab1f2259a8c7c2f
|
data/Gemfile.lock
CHANGED
@@ -1,68 +1,99 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tag_columns (0.1.
|
4
|
+
tag_columns (0.1.9)
|
5
5
|
activesupport
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (
|
10
|
+
activesupport (6.0.3.2)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 0.7, < 2)
|
13
13
|
minitest (~> 5.1)
|
14
14
|
tzinfo (~> 1.1)
|
15
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
16
|
+
ast (2.4.1)
|
15
17
|
binding_of_caller (0.8.0)
|
16
18
|
debug_inspector (>= 0.0.1)
|
17
|
-
byebug (
|
18
|
-
coderay (1.1.
|
19
|
-
concurrent-ruby (1.1.
|
20
|
-
coveralls (0.8.
|
19
|
+
byebug (11.1.3)
|
20
|
+
coderay (1.1.3)
|
21
|
+
concurrent-ruby (1.1.7)
|
22
|
+
coveralls (0.8.23)
|
21
23
|
json (>= 1.8, < 3)
|
22
24
|
simplecov (~> 0.16.1)
|
23
25
|
term-ansicolor (~> 1.3)
|
24
|
-
thor (
|
26
|
+
thor (>= 0.19.4, < 2.0)
|
25
27
|
tins (~> 1.6)
|
26
28
|
debug_inspector (0.0.3)
|
27
|
-
docile (1.3.
|
28
|
-
i18n (1.5
|
29
|
+
docile (1.3.2)
|
30
|
+
i18n (1.8.5)
|
29
31
|
concurrent-ruby (~> 1.0)
|
30
32
|
interception (0.5)
|
31
|
-
json (2.1
|
32
|
-
method_source (0.
|
33
|
-
minitest (5.
|
34
|
-
os (1.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
pry
|
39
|
-
|
40
|
-
|
41
|
-
pry-
|
33
|
+
json (2.3.1)
|
34
|
+
method_source (1.0.0)
|
35
|
+
minitest (5.14.1)
|
36
|
+
os (1.1.1)
|
37
|
+
parallel (1.19.2)
|
38
|
+
parser (2.7.1.4)
|
39
|
+
ast (~> 2.4.1)
|
40
|
+
pry (0.13.1)
|
41
|
+
coderay (~> 1.1)
|
42
|
+
method_source (~> 1.0)
|
43
|
+
pry-byebug (3.9.0)
|
44
|
+
byebug (~> 11.0)
|
45
|
+
pry (~> 0.13.0)
|
46
|
+
pry-rescue (1.5.2)
|
42
47
|
interception (>= 0.5)
|
43
48
|
pry (>= 0.12.0)
|
44
|
-
pry-stack_explorer (0.
|
45
|
-
binding_of_caller (
|
46
|
-
pry (
|
47
|
-
pry-test (0.6.
|
49
|
+
pry-stack_explorer (0.5.1)
|
50
|
+
binding_of_caller (~> 0.7)
|
51
|
+
pry (~> 0.13)
|
52
|
+
pry-test (0.6.6)
|
48
53
|
os
|
49
54
|
pry
|
50
55
|
pry-byebug
|
51
56
|
pry-rescue
|
52
57
|
pry-stack_explorer
|
53
|
-
|
58
|
+
rainbow (3.0.0)
|
59
|
+
rake (13.0.1)
|
60
|
+
regexp_parser (1.7.1)
|
61
|
+
rexml (3.2.4)
|
62
|
+
rubocop (0.89.1)
|
63
|
+
parallel (~> 1.10)
|
64
|
+
parser (>= 2.7.1.1)
|
65
|
+
rainbow (>= 2.2.2, < 4.0)
|
66
|
+
regexp_parser (>= 1.7)
|
67
|
+
rexml
|
68
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
69
|
+
ruby-progressbar (~> 1.7)
|
70
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
71
|
+
rubocop-ast (0.3.0)
|
72
|
+
parser (>= 2.7.1.4)
|
73
|
+
rubocop-performance (1.7.1)
|
74
|
+
rubocop (>= 0.82.0)
|
75
|
+
ruby-progressbar (1.10.1)
|
54
76
|
simplecov (0.16.1)
|
55
77
|
docile (~> 1.1)
|
56
78
|
json (>= 1.8, < 3)
|
57
79
|
simplecov-html (~> 0.10.0)
|
58
80
|
simplecov-html (0.10.2)
|
81
|
+
standard (0.5.2)
|
82
|
+
rubocop (~> 0.89.1)
|
83
|
+
rubocop-performance (~> 1.7.1)
|
84
|
+
standardrb (1.0.0)
|
85
|
+
standard
|
86
|
+
sync (0.5.0)
|
59
87
|
term-ansicolor (1.7.1)
|
60
88
|
tins (~> 1.0)
|
61
|
-
thor (0.
|
89
|
+
thor (1.0.1)
|
62
90
|
thread_safe (0.3.6)
|
63
|
-
tins (1.
|
64
|
-
|
91
|
+
tins (1.25.0)
|
92
|
+
sync
|
93
|
+
tzinfo (1.2.7)
|
65
94
|
thread_safe (~> 0.1)
|
95
|
+
unicode-display_width (1.7.0)
|
96
|
+
zeitwerk (2.4.0)
|
66
97
|
|
67
98
|
PLATFORMS
|
68
99
|
ruby
|
@@ -71,6 +102,7 @@ DEPENDENCIES
|
|
71
102
|
coveralls
|
72
103
|
pry-test
|
73
104
|
rake
|
105
|
+
standardrb
|
74
106
|
tag_columns!
|
75
107
|
|
76
108
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Lines of Code](http://img.shields.io/badge/lines_of_code-
|
1
|
+
[![Lines of Code](http://img.shields.io/badge/lines_of_code-88-brightgreen.svg?style=flat)](http://blog.codinghorror.com/the-best-code-is-no-code-at-all/)
|
2
2
|
[![Maintainability](https://api.codeclimate.com/v1/badges/7503486b1bb494b5d976/maintainability)](https://codeclimate.com/github/hopsoft/tag_columns/maintainability)
|
3
3
|
[![Build Status](http://img.shields.io/travis/hopsoft/tag_columns.svg?style=flat)](https://travis-ci.org/hopsoft/tag_columns)
|
4
4
|
[![Coverage Status](https://img.shields.io/coveralls/hopsoft/tag_columns.svg?style=flat)](https://coveralls.io/r/hopsoft/tag_columns?branch=master)
|
data/bin/standardize
ADDED
data/lib/tag_columns.rb
CHANGED
@@ -25,13 +25,22 @@ module TagColumns
|
|
25
25
|
|
26
26
|
define_singleton_method :"unique_#{method_name}" do |conditions = "true"|
|
27
27
|
unnest = Arel::Nodes::NamedFunction.new("unnest", [arel_table[column_name]])
|
28
|
-
query = distinct.select(unnest)
|
29
|
-
where(conditions)
|
30
|
-
where.not(arel_table[column_name].eq(nil))
|
31
|
-
where.not(arel_table[column_name].eq("{}"))
|
28
|
+
query = distinct.select(unnest)
|
29
|
+
.where(conditions)
|
30
|
+
.where.not(arel_table[column_name].eq(nil))
|
31
|
+
.where.not(arel_table[column_name].eq("{}"))
|
32
32
|
connection.execute(query.to_sql).values.flatten.sort
|
33
33
|
end
|
34
34
|
|
35
|
+
define_singleton_method :"#{method_name}_cloud" do |conditions = "true"|
|
36
|
+
unnest = Arel::Nodes::NamedFunction.new("unnest", [arel_table[column_name]])
|
37
|
+
query = unscoped.select(unnest.as("tag"))
|
38
|
+
.where(conditions)
|
39
|
+
.where.not(arel_table[column_name].eq(nil))
|
40
|
+
.where.not(arel_table[column_name].eq("{}"))
|
41
|
+
from(query).group("tag").order("tag").pluck(Arel.sql("tag, count(*) as count"))
|
42
|
+
end
|
43
|
+
|
35
44
|
scope :"with_#{method_name}", -> {
|
36
45
|
where.not(arel_table[column_name].eq(nil)).where.not(arel_table[column_name].eq("{}"))
|
37
46
|
}
|
data/lib/tag_columns/version.rb
CHANGED
data/tag_columns.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.expand_path("../lib/tag_columns/version", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = "tag_columns"
|
5
|
+
gem.license = "MIT"
|
6
|
+
gem.version = TagColumns::VERSION
|
7
|
+
gem.authors = ["Nathan Hopkins"]
|
8
|
+
gem.email = ["natehop@gmail.com"]
|
9
|
+
gem.homepage = "https://github.com/hopsoft/tag_columns"
|
10
|
+
gem.summary = "Fast & simple Rails ActiveRecord model tagging using PostgreSQL's Array datatype"
|
11
|
+
|
12
|
+
gem.files = Dir["lib/**/*.rb", "bin/*", "[A-Z]*"]
|
13
|
+
gem.test_files = Dir["test/**/*.rb"]
|
14
|
+
|
15
|
+
gem.add_dependency "activesupport"
|
16
|
+
|
17
|
+
gem.add_development_dependency "rake"
|
18
|
+
gem.add_development_dependency "pry-test"
|
19
|
+
gem.add_development_dependency "coveralls"
|
20
|
+
gem.add_development_dependency "standardrb"
|
21
|
+
end
|
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.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -66,7 +66,21 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: standardrb
|
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
|
+
description:
|
70
84
|
email:
|
71
85
|
- natehop@gmail.com
|
72
86
|
executables: []
|
@@ -80,14 +94,16 @@ files:
|
|
80
94
|
- Rakefile
|
81
95
|
- bin/console
|
82
96
|
- bin/setup
|
97
|
+
- bin/standardize
|
83
98
|
- lib/tag_columns.rb
|
84
99
|
- lib/tag_columns/version.rb
|
100
|
+
- tag_columns.gemspec
|
85
101
|
- test/test_tag_columns.rb
|
86
102
|
homepage: https://github.com/hopsoft/tag_columns
|
87
103
|
licenses:
|
88
104
|
- MIT
|
89
105
|
metadata: {}
|
90
|
-
post_install_message:
|
106
|
+
post_install_message:
|
91
107
|
rdoc_options: []
|
92
108
|
require_paths:
|
93
109
|
- lib
|
@@ -102,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
118
|
- !ruby/object:Gem::Version
|
103
119
|
version: '0'
|
104
120
|
requirements: []
|
105
|
-
rubygems_version: 3.0.
|
106
|
-
signing_key:
|
121
|
+
rubygems_version: 3.0.3
|
122
|
+
signing_key:
|
107
123
|
specification_version: 4
|
108
124
|
summary: Fast & simple Rails ActiveRecord model tagging using PostgreSQL's Array datatype
|
109
125
|
test_files:
|