vidibus-category_tag 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/lib/vidibus/category_tag/mongoid.rb +6 -2
- data/lib/vidibus/category_tag/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Vidibus::CategoryTag [![](http://travis-ci.org/vidibus/vidibus-category_tag.png)](http://travis-ci.org/vidibus/vidibus-category_tag)
|
1
|
+
# Vidibus::CategoryTag [![](http://travis-ci.org/vidibus/vidibus-category_tag.png)](http://travis-ci.org/vidibus/vidibus-category_tag)
|
2
2
|
|
3
3
|
This gem is part of [Vidibus](http://vidibus.org), an open source toolset for building distributed applications.
|
4
4
|
|
@@ -11,7 +11,7 @@ Add `gem "vidibus-category_tag"` to your Gemfile. Then call `bundle install` on
|
|
11
11
|
|
12
12
|
### Housekeeping
|
13
13
|
|
14
|
-
A task that removes
|
14
|
+
A task that removes deleted tag categories from tagged items would be helpful. And we need a way to remove unused tags from categories.
|
15
15
|
|
16
16
|
### MapReduce
|
17
17
|
|
@@ -13,6 +13,11 @@ module Vidibus
|
|
13
13
|
@tags_separator = separator if separator
|
14
14
|
@tags_separator || ','
|
15
15
|
end
|
16
|
+
|
17
|
+
def clean_tags_array(tags)
|
18
|
+
tags = tags.split(tags_separator) unless tags.is_a?(Array)
|
19
|
+
tags.map(&:strip).reject(&:blank?)
|
20
|
+
end
|
16
21
|
end
|
17
22
|
|
18
23
|
def tags
|
@@ -27,8 +32,7 @@ module Vidibus
|
|
27
32
|
hash = {}
|
28
33
|
categories.each do |category, tags|
|
29
34
|
category = category.to_s
|
30
|
-
tags =
|
31
|
-
tags = tags.map(&:strip).reject(&:blank?)
|
35
|
+
tags = self.class.clean_tags_array(tags)
|
32
36
|
hash[category] = tags if tags.present?
|
33
37
|
end
|
34
38
|
self.tags_hash = hash
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-category_tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Martin Jagusch, Andre Pankratz
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-07-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|