phlexi-field 0.0.8 → 0.0.9

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
  SHA256:
3
- metadata.gz: 718d6322b8dd57d2ded2366a0d00ae5191305e98c178459a45660f9badcc73c6
4
- data.tar.gz: cc8e6173c724aa41c00b102342d73b47029c6915d2226b3f0849a3262e929072
3
+ metadata.gz: 250be1049bb60d0ec4f8a97ed44aa2bac660f68f1c2761b2122bed9fa3942046
4
+ data.tar.gz: a630eb20c75e78690931486ad0ca2fcf246d3855ebe0acc82990cb59d02be193
5
5
  SHA512:
6
- metadata.gz: '0962dfaf9ffce3f6319becd919e3ceda58be30922341cf363803e0dec24a528bea3fa5526be4adb2a696e2f1a3cddc1d2824a1041dd17aa0232d33145761d413'
7
- data.tar.gz: c1c1783cba57aa86d069e40e7637771d512fb3a04ccb0df19e6b1b8bb84b3287c58ae7cb3d66f7b0ac914e43bba27b659429c99db7c8f7113ad60120a1d39860
6
+ metadata.gz: 22b15190bcab618d0c1389f421a29e552e2196b8fa8fb85bd7a86489e0a5a6866fb0df78d8b1bef381d418525d26a24eeebdece30ab46c11f85de8c18d42bd67
7
+ data.tar.gz: c80e965b3e329bae6a0b63bc0ffbbbd530bd017f73d5b7152672b301c6f2e33de0cab5dc5affa7ed52b04daaf136dccea9ea4bb0689ee7bc2edee7f1728d9e95
@@ -51,8 +51,8 @@ module Phlexi
51
51
  # end
52
52
  # end
53
53
  # ```
54
- def nest_one(key, object: nil, as: nil, template: false, &)
55
- object ||= object_value_for(key: key)
54
+ def nest_one(key, as: nil, object: nil, default: nil, template: false, &)
55
+ object ||= object_value_for(key: key) || default
56
56
  key = as || key
57
57
  create_child(key, self.class, object:, template:, builder_klass:, &)
58
58
  end
@@ -73,8 +73,8 @@ module Phlexi
73
73
  # ```
74
74
  # The object within the block is a `Namespace` object that maps each object within the enumerable
75
75
  # to another `Namespace` or `Field`.
76
- def nest_many(key, collection: nil, as: nil, template: false, &)
77
- collection ||= Array(object_value_for(key: key))
76
+ def nest_many(key, as: nil, collection: nil, default: nil, template: false, &)
77
+ collection ||= Array(object_value_for(key: key)).presence || default
78
78
  key = as || key
79
79
  create_child(key, self.class::NamespaceCollection, collection:, template:, &)
80
80
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlexi
4
4
  module Field
5
- VERSION = "0.0.8"
5
+ VERSION = "0.0.9"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlexi-field
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-05 00:00:00.000000000 Z
11
+ date: 2024-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex