minimal_tags 0.2.6 → 0.2.7
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 +4 -4
- data/.gitignore +1 -0
- data/README.md +4 -2
- data/lib/minimal_tags/persistence/sequel.rb +3 -2
- data/lib/minimal_tags/version.rb +1 -1
- metadata +2 -3
- data/gemfiles/sequel_4.gemfile.lock +0 -38
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 982ffb3fcbf0aae167cfc494d8422f4f29d14583
|
|
4
|
+
data.tar.gz: c99866038a6379463d73299e27631db7b99d2d56
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ece0a77b308a0d362d4fb2e08f4cc50246fd03315108e8f865ffffff07f07519e587528b9b6fe93c5ecbc6d167331e4f32b473988a11fd19d36ed634794ba35
|
|
7
|
+
data.tar.gz: 42e3d2a8015fda7db10bf596a0f4f0c6586c526adeca0d4d06c5fbee0490751297b96bba8d0e66b8b3bb970a13aae990ccdb788000327ba9fe72451388efa205
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
# MinimalTags
|
|
9
9
|
|
|
10
|
-
MinimalTags is a tiny gem for adding tagging support to [Mongoid](https://github.com/mongodb/mongoid)
|
|
10
|
+
MinimalTags is a tiny gem for adding tagging support to [Mongoid](https://github.com/mongodb/mongoid), [ActiveRecord](https://github.com/rails/rails/tree/master/activerecord) and [Sequel](http://sequel.jeremyevans.net/).
|
|
11
11
|
|
|
12
12
|
Multiple tag fields can be used, each with their own way of formatting.
|
|
13
13
|
|
|
14
|
+
**Please Note: ActiveRecord and Sequel both require PostgreSQL.**
|
|
15
|
+
|
|
14
16
|
## Installation
|
|
15
17
|
|
|
16
18
|
Add to your Gemfile:
|
|
@@ -74,7 +76,7 @@ end
|
|
|
74
76
|
```
|
|
75
77
|
|
|
76
78
|
You can define multiple tag fields, just ensure they have unique names.
|
|
77
|
-
Formatters can be defined on each tag field if needed, otherwise the default, [MinimalTags::SimpleFormatter](https://github.com/harrisbaird/minimal_tags/blob/master/lib/minimal_tags/simple_formatter.rb) be used.
|
|
79
|
+
Formatters can be defined on each tag field if needed, otherwise the default, [MinimalTags::SimpleFormatter](https://github.com/harrisbaird/minimal_tags/blob/master/lib/minimal_tags/simple_formatter.rb) will be used.
|
|
78
80
|
|
|
79
81
|
### Changing the default formatter
|
|
80
82
|
|
|
@@ -35,8 +35,9 @@ module MinimalTags
|
|
|
35
35
|
TAG_SEARCH_TYPES.each do |prefix, operator|
|
|
36
36
|
TAG_PREFIX_TYPES.each do |method, without_prefix|
|
|
37
37
|
define_singleton_method "#{without_prefix}#{prefix}_#{field_name}" do |tags|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
normalized_tags = formatter.normalize(tags)
|
|
39
|
+
normalized_tags = ::Sequel.pg_array(normalized_tags, :text)
|
|
40
|
+
query = ::Sequel.pg_array_op(field_name).send(operator, normalized_tags)
|
|
40
41
|
send(method, query)
|
|
41
42
|
end
|
|
42
43
|
end
|
data/lib/minimal_tags/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: minimal_tags
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- harrisbaird
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-07-
|
|
11
|
+
date: 2016-07-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pg
|
|
@@ -111,7 +111,6 @@ files:
|
|
|
111
111
|
- gemfiles/activerecord_50.gemfile
|
|
112
112
|
- gemfiles/mongoid_5.gemfile
|
|
113
113
|
- gemfiles/sequel_4.gemfile
|
|
114
|
-
- gemfiles/sequel_4.gemfile.lock
|
|
115
114
|
- lib/minimal_tags.rb
|
|
116
115
|
- lib/minimal_tags/persistence/activerecord.rb
|
|
117
116
|
- lib/minimal_tags/persistence/mongoid.rb
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: ../
|
|
3
|
-
specs:
|
|
4
|
-
minimal_tags (0.2.5)
|
|
5
|
-
|
|
6
|
-
GEM
|
|
7
|
-
remote: https://rubygems.org/
|
|
8
|
-
specs:
|
|
9
|
-
codeclimate-test-reporter (0.6.0)
|
|
10
|
-
simplecov (>= 0.7.1, < 1.0.0)
|
|
11
|
-
docile (1.1.5)
|
|
12
|
-
json (1.8.3)
|
|
13
|
-
minitest (5.9.0)
|
|
14
|
-
pg (0.18.4)
|
|
15
|
-
rake (10.5.0)
|
|
16
|
-
sequel (4.36.0)
|
|
17
|
-
simplecov (0.12.0)
|
|
18
|
-
docile (~> 1.1.0)
|
|
19
|
-
json (>= 1.8, < 3)
|
|
20
|
-
simplecov-html (~> 0.10.0)
|
|
21
|
-
simplecov-html (0.10.0)
|
|
22
|
-
yard (0.9.0)
|
|
23
|
-
|
|
24
|
-
PLATFORMS
|
|
25
|
-
ruby
|
|
26
|
-
|
|
27
|
-
DEPENDENCIES
|
|
28
|
-
bundler (~> 1.10)
|
|
29
|
-
codeclimate-test-reporter
|
|
30
|
-
minimal_tags!
|
|
31
|
-
minitest
|
|
32
|
-
pg
|
|
33
|
-
rake (~> 10.0)
|
|
34
|
-
sequel (>= 4.0.0, <= 6.0.0)
|
|
35
|
-
yard
|
|
36
|
-
|
|
37
|
-
BUNDLED WITH
|
|
38
|
-
1.12.5
|