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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a78535559f987bdb7760d0ec28048c54d2fd627
4
- data.tar.gz: ec311f0d03393ec2ea2a727fa93cac35f910c9bd
3
+ metadata.gz: d309f17a7cace28365d69fd6a09a9fbea7834459
4
+ data.tar.gz: 12dc29109bc78c788c26aaf4983abf1ee5bc68d1
5
5
  SHA512:
6
- metadata.gz: 2b9c24b0f67b298297f21d831577bfb77820b510876ece1323cebfb4da040359e25d51ff03ad8924ca44f64ac6b0d5623b13a9d5a919b3ec87176db963d3426c
7
- data.tar.gz: 439c83a56cf80f4cb031bee23d3cb967d86b659ab6315d0dcf66927aab7d8aefdb83cb1c45f421ef594758927cf822710e925eae75332f5a625fc23b6c8f7761
6
+ metadata.gz: 737cf93c2fb26e0d8f57765cedbe584bdee8407e17f9dc3242094b195288025afd1b9f846f292faae49ca1259bc11352ee90aee4c75ccc1d9550f27472d81266
7
+ data.tar.gz: 71d927e979f1975b9d9aa813b8136f8457fd4e713bb1732a20c94de88e84d37123c9d96cd3fae6b790fbf73bcb001eab00b938347e84ee5de45eebe40932f228
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ # 0.5.0
4
+ * Transfer field args to setters
5
+
6
+
3
7
  # 0.4.1
4
8
  * Make setters more robust
5
9
 
@@ -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, {}, nil)
92
+ add_setter(scope, field_name, cleaned_args, nil)
92
93
  end
93
- @scopes[scope][:fields][field_name] = {args: args.select{ |k| k != :setter}, block: block}
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)
@@ -1,3 +1,3 @@
1
1
  module ModelView
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Pretorius