mongoid-tags-arent-hard 1.0.7 → 1.1.0
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.
@@ -1,13 +1,13 @@
|
|
1
1
|
module Mongoid
|
2
2
|
module TagsArentHard
|
3
|
-
class Tags
|
3
|
+
class Tags < BasicObject
|
4
4
|
|
5
5
|
attr_accessor :tag_list
|
6
6
|
attr_accessor :options
|
7
|
-
delegate :join, :map, :each, :inspect, :==, :===, :eql?, :__bson_dump__, :delete, :&, :to_ary, :to_json, :as_json, to: :tag_list
|
7
|
+
# delegate :join, :map, :each, :inspect, :==, :===, :eql?, :__bson_dump__, :delete, :&, :to_ary, :to_json, :as_json, to: :tag_list
|
8
8
|
|
9
9
|
def initialize(*tag_list, options)
|
10
|
-
self.options = {separator: Mongoid::TagsArentHard.config.separator}.merge(options)
|
10
|
+
self.options = {separator: ::Mongoid::TagsArentHard.config.separator}.merge(options)
|
11
11
|
self.tag_list = []
|
12
12
|
self.<<(*tag_list)
|
13
13
|
end
|
@@ -39,6 +39,30 @@ module Mongoid
|
|
39
39
|
self.to_s
|
40
40
|
end
|
41
41
|
|
42
|
+
def method_missing(sym, *args, &block)
|
43
|
+
self.tag_list.send(sym, *args, &block)
|
44
|
+
end
|
45
|
+
|
46
|
+
def respond_to_missing?(method_name, include_private = false)
|
47
|
+
self.tag_list.respond_to?(method_name)
|
48
|
+
end
|
49
|
+
|
50
|
+
def kind_of?(klass)
|
51
|
+
klass == ::Mongoid::TagsArentHard::Tags || klass == ::Array
|
52
|
+
end
|
53
|
+
|
54
|
+
def is_a?(klass)
|
55
|
+
self.kind_of?(klass)
|
56
|
+
end
|
57
|
+
|
58
|
+
def ==(other)
|
59
|
+
self.tag_list == other
|
60
|
+
end
|
61
|
+
|
62
|
+
def !=(other)
|
63
|
+
!self.==(other)
|
64
|
+
end
|
65
|
+
|
42
66
|
end
|
43
67
|
end
|
44
68
|
end
|
@@ -105,4 +105,28 @@ describe Mongoid::TagsArentHard::Tags do
|
|
105
105
|
|
106
106
|
end
|
107
107
|
|
108
|
+
describe "!=" do
|
109
|
+
|
110
|
+
it "works correctly against an array" do
|
111
|
+
expect {
|
112
|
+
if tags != tags.tag_list
|
113
|
+
raise "Hell!"
|
114
|
+
end
|
115
|
+
}.to_not raise_error
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "==" do
|
121
|
+
|
122
|
+
it "works correctly against an array" do
|
123
|
+
expect {
|
124
|
+
if tags == tags.tag_list
|
125
|
+
raise "Hell!"
|
126
|
+
end
|
127
|
+
}.to raise_error
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
108
132
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-tags-arent-hard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|