minimal_tags 0.2.2 → 0.2.3

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
  SHA1:
3
- metadata.gz: be66c2c539062022271fa298f8635683a4d19bca
4
- data.tar.gz: f66eadac32e03572f6652ac7eae75e9f7efa743f
3
+ metadata.gz: e2892db32ac72c1bdf42d1b12843f36931b53e1d
4
+ data.tar.gz: dd1ee091b5c7af7692393c187ea329f383a8fb13
5
5
  SHA512:
6
- metadata.gz: 0a63708be1d4f16ceeccfaa53866bc6efdca2353942f739fa972ca1ba3c40326e9d75b6e2d05cb4ddc37869e8938f97cc42569fcc0289ce34f10785376cd7a03
7
- data.tar.gz: 7e440993e58512125425125431ad3785871ca0f4afa2848e672db4fb8ec98e66cbc2ef9cb99a30e0329078da9aba9d713fff3f6ad0996e39b6073f6620f3fea5
6
+ metadata.gz: e3f26d5dee52d5a0d7d603f9edc2855aa7601f7372034bae34d83eac6a8789a53bbf801632701ad1295ce6cbaf28c7218521bda05b6f9f9d48b0a5be4052354c
7
+ data.tar.gz: 4d67ee35a403d6ff2249443ca7fe3a5b650e741983890dfb7d1e0df9093e764db90dbb6b8d0404129b93b5da7bd38ec70cc556fe20448a43d6b341a860c205f9
data/.travis.yml CHANGED
@@ -3,6 +3,10 @@ rvm:
3
3
  - 2.1.0
4
4
  - 2.2.3
5
5
  - 2.3.0
6
+ gemfile:
7
+ - gemfiles/activerecord_41.gemfile
8
+ - gemfiles/activerecord_42.gemfile
9
+ - gemfiles/activerecord_50.gemfile
6
10
  services:
7
11
  - mongodb
8
12
  - postgresql
@@ -13,3 +17,6 @@ before_script:
13
17
  addons:
14
18
  code_climate:
15
19
  repo_token: 3c954617ba40beceb056cc73b82e00a6dc1fa2193cda386dc6c2128bdd61a804
20
+ matrix:
21
+ allow_failures:
22
+ - gemfile: gemfiles/activerecord_50.gemfile
data/README.md CHANGED
@@ -52,15 +52,23 @@ end
52
52
  ```
53
53
 
54
54
  You can define multiple tag fields, just ensure they have unique names.
55
- Formatters can be defined on each tag field if needed, otherwise the default be used.
55
+ 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.
56
+
57
+ ### Changing the default formatter
58
+
59
+ ```ruby
60
+ MinimalTags.default_formatter = UnderscoreTagFormatter.new
61
+ ```
56
62
 
57
63
  ## Searching
58
64
  The following scopes are also added for each tag field and can be chained:
59
- `.any_*`, `.all_*`
65
+ `.any_*`, `.all_*`, `.without_any_*`, `.without_all_*`
60
66
 
61
67
  ```ruby
62
68
  Document.any_tags(['a', 'b', 'c'])
63
69
  Document.all_tags(['a', 'b', 'c'])
70
+ Document.without_any_tags(['a', 'b', 'c'])
71
+ Document.without_all_tags(['a', 'b', 'c'])
64
72
  ```
65
73
 
66
74
  ## Contributing
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '~> 4.1.0'
4
+
5
+ gemspec path: '../'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '~> 4.2.0'
4
+
5
+ gemspec path: '../'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '~> 5.0.0.beta3'
4
+
5
+ gemspec path: '../'
@@ -31,6 +31,10 @@ module MinimalTags
31
31
  scope "#{prefix}_#{field_name}", lambda { |tags|
32
32
  where("#{field_name} #{operator} ARRAY[?]", formatter.normalize(tags))
33
33
  }
34
+
35
+ scope "without_#{prefix}_#{field_name}", lambda { |tags|
36
+ where.not("#{field_name} #{operator} ARRAY[?]", formatter.normalize(tags))
37
+ }
34
38
  end
35
39
 
36
40
  # Normalize tags on save
@@ -3,7 +3,9 @@ module MinimalTags
3
3
  module Mongoid
4
4
  TAG_SEARCH_TYPES = {
5
5
  all: 'all',
6
- any: 'in'
6
+ any: 'in',
7
+ without_all: 'ne',
8
+ without_any: 'nin'
7
9
  }
8
10
 
9
11
  ##
@@ -1,3 +1,3 @@
1
1
  module MinimalTags
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
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.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - harrisbaird
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-29 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -146,6 +146,9 @@ files:
146
146
  - Gemfile
147
147
  - README.md
148
148
  - Rakefile
149
+ - gemfiles/activerecord_41.gemfile
150
+ - gemfiles/activerecord_42.gemfile
151
+ - gemfiles/activerecord_50.gemfile
149
152
  - lib/minimal_tags.rb
150
153
  - lib/minimal_tags/persistence/activerecord.rb
151
154
  - lib/minimal_tags/persistence/mongoid.rb