model_view 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/model_view.rb +3 -2
- data/lib/model_view/version.rb +1 -1
- data/spec/model_view/model_view_spec.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d309f17a7cace28365d69fd6a09a9fbea7834459
|
4
|
+
data.tar.gz: 12dc29109bc78c788c26aaf4983abf1ee5bc68d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 737cf93c2fb26e0d8f57765cedbe584bdee8407e17f9dc3242094b195288025afd1b9f846f292faae49ca1259bc11352ee90aee4c75ccc1d9550f27472d81266
|
7
|
+
data.tar.gz: 71d927e979f1975b9d9aa813b8136f8457fd4e713bb1732a20c94de88e84d37123c9d96cd3fae6b790fbf73bcb001eab00b938347e84ee5de45eebe40932f228
|
data/CHANGELOG.md
CHANGED
data/lib/model_view.rb
CHANGED
@@ -87,10 +87,11 @@ module ModelView
|
|
87
87
|
def add_field(scope, field_name, args, block)
|
88
88
|
@scopes ||= {ROOT => new_opts}
|
89
89
|
@scopes[scope] ||= new_opts
|
90
|
+
cleaned_args = args.select{ |k| k != :setter}
|
90
91
|
if args[:setter]
|
91
|
-
add_setter(scope, field_name,
|
92
|
+
add_setter(scope, field_name, cleaned_args, nil)
|
92
93
|
end
|
93
|
-
@scopes[scope][:fields][field_name] = {args:
|
94
|
+
@scopes[scope][:fields][field_name] = {args: cleaned_args, block: block}
|
94
95
|
end
|
95
96
|
|
96
97
|
def add_setter(scope, field_name, args, block)
|
data/lib/model_view/version.rb
CHANGED
@@ -26,13 +26,13 @@ describe ModelView do
|
|
26
26
|
|
27
27
|
context "with setter set to true" do
|
28
28
|
it "adds the field and setter to the root scope" do
|
29
|
-
dummy_class.field :a_field, {setter: true}
|
29
|
+
dummy_class.field :a_field, {setter: true, arg1: "foo"}
|
30
30
|
|
31
31
|
scope_fields = dummy_class.scopes[root_scope][:fields]
|
32
|
-
expect(scope_fields[:a_field]).to eq({args: {}, block: nil})
|
32
|
+
expect(scope_fields[:a_field]).to eq({args: {arg1: "foo"}, block: nil})
|
33
33
|
|
34
34
|
scope_setters = dummy_class.scopes[root_scope][:setters]
|
35
|
-
expect(scope_setters[:a_field]).to eq({args: {}, block: nil})
|
35
|
+
expect(scope_setters[:a_field]).to eq({args: {arg1: "foo"}, block: nil})
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|