mongoid_taggable_with_context-meta 0.0.3 → 0.0.4
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.
- data/README.md +21 -77
- data/VERSION +1 -1
- data/mongoid_taggable_with_context-meta.gemspec +1 -1
- metadata +25 -25
data/README.md
CHANGED
@@ -22,42 +22,35 @@ or in Gemfile:
|
|
22
22
|
gem 'mongoid_taggable_with_context-meta'
|
23
23
|
```
|
24
24
|
|
25
|
-
TODO from here
|
26
|
-
|
27
25
|
Basic Usage
|
28
26
|
-----------
|
29
27
|
|
30
|
-
To make a document taggable you need to include Mongoid::TaggableOnContext into your document and call the *taggable* macro with
|
28
|
+
To make a document taggable with meta information you need to include Mongoid::TaggableOnContext and Mongoid::TaggableOnContext::Meta into your document and call the *taggable* macro with the argument 'enable_meta' set to true:
|
31
29
|
|
32
30
|
```ruby
|
33
31
|
class Post
|
34
32
|
include Mongoid::Document
|
35
33
|
include Mongoid::TaggableWithContext
|
36
|
-
|
37
|
-
field :title
|
38
|
-
field :content
|
34
|
+
include Mongoid::TaggableWithContext::Meta
|
39
35
|
|
40
36
|
# default context is 'tags'.
|
41
37
|
# This creates #tags, #tags=, #tags_array, #tags_array= instance methods
|
42
|
-
|
43
|
-
# #tags method returns space separated string
|
44
|
-
# #tags= methods accepts space separated string
|
45
|
-
# #tags_array method returns an array of tags
|
46
|
-
# #tags_array= method accepts an array of tags
|
47
|
-
# #tags and #tags_array are automatically synched.
|
48
|
-
taggable
|
38
|
+
taggable :enable_meta => true
|
49
39
|
|
50
40
|
# tagging for 'interests' context.
|
51
41
|
# This creates #interests, #interests=, #interests_array, #interests_array= instance methods
|
52
|
-
taggable :interests
|
42
|
+
taggable :interests, :enable_meta => true
|
53
43
|
|
54
|
-
# tagging for 'skills' context.
|
55
|
-
# This creates #skills, #skills=, #skills_array, #skills_array= instance methods
|
56
|
-
# changing tag separator to "," (Default is " ")
|
57
|
-
taggable :skills, :separator => ','
|
58
44
|
end
|
59
45
|
```
|
60
46
|
|
47
|
+
Please refer to https://github.com/aq1018/mongoid_taggable_with_context for information on how to use Mongoid::TaggableOnContext
|
48
|
+
|
49
|
+
TODO: add dynamic setter for use with form fields, rest ...
|
50
|
+
-----------------------------------------------------------
|
51
|
+
|
52
|
+
-No Support as for now-
|
53
|
+
|
61
54
|
Then in your form, for example:
|
62
55
|
|
63
56
|
```rhtml
|
@@ -88,67 +81,18 @@ Then in your form, for example:
|
|
88
81
|
<% end %>
|
89
82
|
```
|
90
83
|
|
91
|
-
|
92
|
-
----------------------
|
93
|
-
|
94
|
-
By including an aggregation strategy in your document, tag aggregations will be automatically available to you.
|
95
|
-
This lib presents the following aggregation strategies:
|
96
|
-
|
97
|
-
* MapReduce
|
98
|
-
* RealTime
|
99
|
-
|
100
|
-
The following document will automatically aggregate counts on all tag contexts.
|
101
|
-
|
102
|
-
```ruby
|
103
|
-
class Post
|
104
|
-
include Mongoid::Document
|
105
|
-
include Mongoid::TaggableWithContext
|
106
|
-
|
107
|
-
# automatically adds real time aggregations to all tag contexts
|
108
|
-
include Mongoid::TaggableWithContext::AggregationStrategy::RealTime
|
109
|
-
|
110
|
-
# alternatively for map-reduce
|
111
|
-
# include Mongoid::TaggableWithContext::AggregationStrategy::MapReduce
|
112
|
-
|
113
|
-
field :title
|
114
|
-
field :content
|
115
|
-
|
116
|
-
taggable
|
117
|
-
taggable :interests
|
118
|
-
taggable :skills, :separator => ','
|
119
|
-
end
|
120
|
-
```
|
121
|
-
|
122
|
-
When you include an aggregation strategy, your document also gains a few extra methods to retrieve aggregation data.
|
123
|
-
In the case of previous example the following methods are included:
|
124
|
-
|
125
|
-
```ruby
|
126
|
-
Post.tags
|
127
|
-
Post.tags_with_weight
|
128
|
-
Post.interests
|
129
|
-
Post.interests_with_weight
|
130
|
-
Post.skills
|
131
|
-
Post.skills_with_weight
|
132
|
-
```
|
133
|
-
|
134
|
-
Here is how to use these methods in more detail:
|
84
|
+
Here is an overview ofthe provided methods:
|
135
85
|
|
136
86
|
```ruby
|
137
|
-
Post.create!(:tags => "food
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
#
|
144
|
-
#
|
145
|
-
#
|
146
|
-
# ['food', 3],
|
147
|
-
# ['honey', 1],
|
148
|
-
# ['juice', 1],
|
149
|
-
# ['strip', 1],
|
150
|
-
# ['zip', 1]
|
151
|
-
# ]
|
87
|
+
p = Post.create!(:tags => "food ant bee")
|
88
|
+
p.add_tag_with_meta('metatag', {:something => 'Foo', :another => 'Bar'})
|
89
|
+
p.add_tag_with_meta('metatag2', {:something => 'Foo2', :another => 'Bar2'})
|
90
|
+
|
91
|
+
p.tags # => "food ant bee metatag metatag2"
|
92
|
+
p.tags_array # => ["food", "ant", "bee", "metatag", "metatag2"]
|
93
|
+
p.tags_having_meta # => "metatag, metatag2"
|
94
|
+
p.tags_having_meta_array # => ["metatag", "metatag2"]
|
95
|
+
p.tags_including_meta # =>[ ["food", {}], ["ant", {}], ["bee", {}], ["metatag", {:something => 'Foo', :another => 'Bar'}], ["metatag2", {:something => 'Foo2', :another => 'Bar2'}] ]
|
152
96
|
```
|
153
97
|
|
154
98
|
Contributing to mongoid_taggable_with_context-meta
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_taggable_with_context-meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongo
|
16
|
-
requirement: &
|
16
|
+
requirement: &9377260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.5.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *9377260
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mongoid
|
27
|
-
requirement: &
|
27
|
+
requirement: &9376640 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - =
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.4.4
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *9376640
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mongoid_taggable_with_context
|
38
|
-
requirement: &
|
38
|
+
requirement: &9376080 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *9376080
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: database_cleaner
|
49
|
-
requirement: &
|
49
|
+
requirement: &9375480 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *9375480
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bson
|
60
|
-
requirement: &
|
60
|
+
requirement: &9374860 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.5.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *9374860
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bson_ext
|
71
|
-
requirement: &
|
71
|
+
requirement: &9374160 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.5.2
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *9374160
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &9373420 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *9373420
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: mongoid-rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &9372900 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *9372900
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: yard
|
104
|
-
requirement: &
|
104
|
+
requirement: &9372280 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *9372280
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: bundler
|
115
|
-
requirement: &
|
115
|
+
requirement: &9371680 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 1.0.0
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *9371680
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: jeweler
|
126
|
-
requirement: &
|
126
|
+
requirement: &9371020 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *9371020
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: mongoid_taggable_with_context
|
137
|
-
requirement: &
|
137
|
+
requirement: &9302920 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :runtime
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *9302920
|
146
146
|
description: It provides methods to enhance tags with meta data. Extension for gem
|
147
147
|
mongoid_taggable_with_context
|
148
148
|
email: maik@mediavrog.net
|