datts_right 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +63 -1
- data/VERSION +1 -1
- data/datts_right.gemspec +4 -1
- data/lib/datts_right/instance_methods.rb +17 -11
- data/spec/datts_right/add_definitions_spec.rb +4 -0
- data/spec/datts_right/remove_definitions_spec.rb +4 -0
- metadata +30 -14
data/Gemfile.lock
CHANGED
@@ -1,21 +1,78 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
datts_right (0.0.
|
4
|
+
datts_right (0.0.23)
|
5
5
|
datts_right
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ZenTest (4.5.0)
|
11
|
+
abstract (1.0.0)
|
12
|
+
actionmailer (3.0.5)
|
13
|
+
actionpack (= 3.0.5)
|
14
|
+
mail (~> 2.2.15)
|
15
|
+
actionpack (3.0.5)
|
16
|
+
activemodel (= 3.0.5)
|
17
|
+
activesupport (= 3.0.5)
|
18
|
+
builder (~> 2.1.2)
|
19
|
+
erubis (~> 2.6.6)
|
20
|
+
i18n (~> 0.4)
|
21
|
+
rack (~> 1.2.1)
|
22
|
+
rack-mount (~> 0.6.13)
|
23
|
+
rack-test (~> 0.5.7)
|
24
|
+
tzinfo (~> 0.3.23)
|
25
|
+
activemodel (3.0.5)
|
26
|
+
activesupport (= 3.0.5)
|
27
|
+
builder (~> 2.1.2)
|
28
|
+
i18n (~> 0.4)
|
29
|
+
activerecord (3.0.5)
|
30
|
+
activemodel (= 3.0.5)
|
31
|
+
activesupport (= 3.0.5)
|
32
|
+
arel (~> 2.0.2)
|
33
|
+
tzinfo (~> 0.3.23)
|
34
|
+
activeresource (3.0.5)
|
35
|
+
activemodel (= 3.0.5)
|
36
|
+
activesupport (= 3.0.5)
|
37
|
+
activesupport (3.0.5)
|
38
|
+
arel (2.0.9)
|
11
39
|
autotest (4.4.6)
|
12
40
|
ZenTest (>= 4.4.1)
|
41
|
+
builder (2.1.2)
|
13
42
|
diff-lcs (1.1.2)
|
43
|
+
erubis (2.6.6)
|
44
|
+
abstract (>= 1.0.0)
|
14
45
|
git (1.2.5)
|
46
|
+
i18n (0.5.0)
|
15
47
|
jeweler (1.5.2)
|
16
48
|
bundler (~> 1.0.0)
|
17
49
|
git (>= 1.2.5)
|
18
50
|
rake
|
51
|
+
mail (2.2.15)
|
52
|
+
activesupport (>= 2.3.6)
|
53
|
+
i18n (>= 0.4.0)
|
54
|
+
mime-types (~> 1.16)
|
55
|
+
treetop (~> 1.4.8)
|
56
|
+
mime-types (1.16)
|
57
|
+
polyglot (0.3.1)
|
58
|
+
rack (1.2.2)
|
59
|
+
rack-mount (0.6.14)
|
60
|
+
rack (>= 1.0.0)
|
61
|
+
rack-test (0.5.7)
|
62
|
+
rack (>= 1.0)
|
63
|
+
rails (3.0.5)
|
64
|
+
actionmailer (= 3.0.5)
|
65
|
+
actionpack (= 3.0.5)
|
66
|
+
activerecord (= 3.0.5)
|
67
|
+
activeresource (= 3.0.5)
|
68
|
+
activesupport (= 3.0.5)
|
69
|
+
bundler (~> 1.0)
|
70
|
+
railties (= 3.0.5)
|
71
|
+
railties (3.0.5)
|
72
|
+
actionpack (= 3.0.5)
|
73
|
+
activesupport (= 3.0.5)
|
74
|
+
rake (>= 0.8.7)
|
75
|
+
thor (~> 0.14.4)
|
19
76
|
rake (0.8.7)
|
20
77
|
rcov (0.9.9)
|
21
78
|
rspec (2.3.0)
|
@@ -27,6 +84,10 @@ GEM
|
|
27
84
|
diff-lcs (~> 1.1.2)
|
28
85
|
rspec-mocks (2.3.0)
|
29
86
|
sqlite3 (1.3.3)
|
87
|
+
thor (0.14.6)
|
88
|
+
treetop (1.4.9)
|
89
|
+
polyglot (>= 0.3.1)
|
90
|
+
tzinfo (0.3.26)
|
30
91
|
|
31
92
|
PLATFORMS
|
32
93
|
ruby
|
@@ -36,6 +97,7 @@ DEPENDENCIES
|
|
36
97
|
bundler (~> 1.0.0)
|
37
98
|
datts_right!
|
38
99
|
jeweler (~> 1.5.2)
|
100
|
+
rails (>= 3.0.0)
|
39
101
|
rcov
|
40
102
|
rspec (~> 2.3.0)
|
41
103
|
sqlite3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.23
|
data/datts_right.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{datts_right}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.23"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ramon Tayag"]
|
@@ -88,6 +88,7 @@ Gem::Specification.new do |s|
|
|
88
88
|
|
89
89
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
90
90
|
s.add_runtime_dependency(%q<datts_right>, [">= 0"])
|
91
|
+
s.add_development_dependency(%q<rails>, [">= 3.0.0"])
|
91
92
|
s.add_development_dependency(%q<autotest>, [">= 0"])
|
92
93
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
93
94
|
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
@@ -96,6 +97,7 @@ Gem::Specification.new do |s|
|
|
96
97
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
97
98
|
else
|
98
99
|
s.add_dependency(%q<datts_right>, [">= 0"])
|
100
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
99
101
|
s.add_dependency(%q<autotest>, [">= 0"])
|
100
102
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
101
103
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
@@ -105,6 +107,7 @@ Gem::Specification.new do |s|
|
|
105
107
|
end
|
106
108
|
else
|
107
109
|
s.add_dependency(%q<datts_right>, [">= 0"])
|
110
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
108
111
|
s.add_dependency(%q<autotest>, [">= 0"])
|
109
112
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
110
113
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
@@ -133,27 +133,33 @@ module DattsRight
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def add_definitions(hash)
|
136
|
-
hash
|
137
|
-
|
136
|
+
if hash
|
137
|
+
hash.each do |k, v|
|
138
|
+
add_definition k, v
|
139
|
+
end
|
138
140
|
end
|
139
141
|
end
|
140
142
|
|
141
143
|
def remove_definition(key)
|
142
|
-
|
143
|
-
|
144
|
-
if definition
|
145
|
-
definition
|
144
|
+
if key
|
145
|
+
key = key.to_sym
|
146
|
+
if dynamic_attributes_options[:definition]
|
147
|
+
if definition && definition[key]
|
148
|
+
definition.delete(key)
|
149
|
+
else
|
150
|
+
raise NotDefinedError, "#{key} is not defined"
|
151
|
+
end
|
146
152
|
else
|
147
|
-
raise
|
153
|
+
raise NoDefinitionError
|
148
154
|
end
|
149
|
-
else
|
150
|
-
raise NoDefinitionError
|
151
155
|
end
|
152
156
|
end
|
153
157
|
|
154
158
|
def remove_definitions(*array)
|
155
|
-
array
|
156
|
-
|
159
|
+
if array
|
160
|
+
array.each do |a|
|
161
|
+
remove_definition a
|
162
|
+
end
|
157
163
|
end
|
158
164
|
end
|
159
165
|
|
@@ -11,4 +11,8 @@ describe DattsRight, ".add_definitions(hash)" do
|
|
11
11
|
c.should_receive(:add_definition).with(:another, :object_type => "string")
|
12
12
|
c.add_definitions(:robot => {:object_type => "text"}, :another => {:object_type => "string"})
|
13
13
|
end
|
14
|
+
|
15
|
+
it "should not explode if nil is passed" do
|
16
|
+
lambda {Category.create.add_definitions(nil)}.should_not raise_error(NoMethodError)
|
17
|
+
end
|
14
18
|
end
|
@@ -11,4 +11,8 @@ describe DattsRight, ".remove_definitions(array)" do
|
|
11
11
|
c.should_receive(:remove_definition).with(:another)
|
12
12
|
c.remove_definitions(:robot, :another)
|
13
13
|
end
|
14
|
+
|
15
|
+
it "should not explode if nil is passed" do
|
16
|
+
lambda {Category.create.remove_definitions(nil)}.should_not raise_error(NoMethodError)
|
17
|
+
end
|
14
18
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datts_right
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 23
|
10
|
+
version: 0.0.23
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ramon Tayag
|
@@ -39,11 +39,13 @@ dependencies:
|
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
hash:
|
42
|
+
hash: 7
|
43
43
|
segments:
|
44
|
+
- 3
|
44
45
|
- 0
|
45
|
-
|
46
|
-
|
46
|
+
- 0
|
47
|
+
version: 3.0.0
|
48
|
+
name: rails
|
47
49
|
version_requirements: *id002
|
48
50
|
prerelease: false
|
49
51
|
- !ruby/object:Gem::Dependency
|
@@ -57,12 +59,26 @@ dependencies:
|
|
57
59
|
segments:
|
58
60
|
- 0
|
59
61
|
version: "0"
|
60
|
-
name:
|
62
|
+
name: autotest
|
61
63
|
version_requirements: *id003
|
62
64
|
prerelease: false
|
63
65
|
- !ruby/object:Gem::Dependency
|
64
66
|
type: :development
|
65
67
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
name: sqlite3
|
77
|
+
version_requirements: *id004
|
78
|
+
prerelease: false
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
type: :development
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
66
82
|
none: false
|
67
83
|
requirements:
|
68
84
|
- - ~>
|
@@ -74,11 +90,11 @@ dependencies:
|
|
74
90
|
- 0
|
75
91
|
version: 2.3.0
|
76
92
|
name: rspec
|
77
|
-
version_requirements: *
|
93
|
+
version_requirements: *id005
|
78
94
|
prerelease: false
|
79
95
|
- !ruby/object:Gem::Dependency
|
80
96
|
type: :development
|
81
|
-
requirement: &
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
82
98
|
none: false
|
83
99
|
requirements:
|
84
100
|
- - ~>
|
@@ -90,11 +106,11 @@ dependencies:
|
|
90
106
|
- 0
|
91
107
|
version: 1.0.0
|
92
108
|
name: bundler
|
93
|
-
version_requirements: *
|
109
|
+
version_requirements: *id006
|
94
110
|
prerelease: false
|
95
111
|
- !ruby/object:Gem::Dependency
|
96
112
|
type: :development
|
97
|
-
requirement: &
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
98
114
|
none: false
|
99
115
|
requirements:
|
100
116
|
- - ~>
|
@@ -106,11 +122,11 @@ dependencies:
|
|
106
122
|
- 2
|
107
123
|
version: 1.5.2
|
108
124
|
name: jeweler
|
109
|
-
version_requirements: *
|
125
|
+
version_requirements: *id007
|
110
126
|
prerelease: false
|
111
127
|
- !ruby/object:Gem::Dependency
|
112
128
|
type: :development
|
113
|
-
requirement: &
|
129
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
114
130
|
none: false
|
115
131
|
requirements:
|
116
132
|
- - ">="
|
@@ -120,7 +136,7 @@ dependencies:
|
|
120
136
|
- 0
|
121
137
|
version: "0"
|
122
138
|
name: rcov
|
123
|
-
version_requirements: *
|
139
|
+
version_requirements: *id008
|
124
140
|
prerelease: false
|
125
141
|
description: Creates a separate table that saves all your dynamic attributes.
|
126
142
|
email: ramon@tayag.net
|