attribute_struct 0.2.12 → 0.2.14
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/attribute_struct/attribute_hash.rb +1 -1
- data/lib/attribute_struct/attribute_struct.rb +11 -5
- data/lib/attribute_struct/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2784bc7275103df06114555bef8c340a6af7e41d
|
4
|
+
data.tar.gz: a718c494924468d7653683451f5734debeeaf536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebdb20db6a9a5a1060a7868f60aeb9f1ed1a2e8e00767027ce530d5b2a7584d7398e16b69c4822c87b0d2325c21db9425bd5094b305e319d04205111998dcd22
|
7
|
+
data.tar.gz: a5e0a40f61d168e0653f9322123f0b33ece9e0b576db793bb0910643cd3fc37ffe201d8a6178ac45d12e3bfc1f5bea8fb4c43ea6ee5b9124e33651bef218ac47
|
data/CHANGELOG.md
CHANGED
@@ -172,7 +172,9 @@ class AttributeStruct < BasicObject
|
|
172
172
|
if(orig == :__unset__)
|
173
173
|
@table[sym] = base
|
174
174
|
else
|
175
|
-
|
175
|
+
unless(orig.is_a?(CollapseArray))
|
176
|
+
orig = CollapseArray.new.push(orig)
|
177
|
+
end
|
176
178
|
orig << base
|
177
179
|
@table[sym] = orig
|
178
180
|
end
|
@@ -193,14 +195,16 @@ class AttributeStruct < BasicObject
|
|
193
195
|
end
|
194
196
|
block.arity == 0 ? leaf._build(&block) : leaf._build(leaf, &block)
|
195
197
|
if(orig)
|
196
|
-
|
198
|
+
unless(orig.is_a?(CollapseArray))
|
199
|
+
orig = CollapseArray.new.push(orig)
|
200
|
+
end
|
197
201
|
orig << leaf
|
198
202
|
else
|
199
203
|
orig = leaf
|
200
204
|
end
|
201
|
-
@table[sym] =
|
205
|
+
@table[sym] = orig
|
202
206
|
else
|
203
|
-
if(args.size > 1 && args.all?{|i| i.is_a?(::String) || i.is_a?(::Symbol)})
|
207
|
+
if(args.size > 1 && args.all?{|i| i.is_a?(::String) || i.is_a?(::Symbol)} && !_state(:value_collapse))
|
204
208
|
@table[sym] = _klass_new unless @table[sym].is_a?(_klass)
|
205
209
|
endpoint = args.inject(@table[sym]) do |memo, k|
|
206
210
|
unless(memo[k].is_a?(_klass))
|
@@ -211,7 +215,9 @@ class AttributeStruct < BasicObject
|
|
211
215
|
return endpoint # custom break out
|
212
216
|
else
|
213
217
|
if(_state(:value_collapse) && !(leaf = @table[sym]).nil?)
|
214
|
-
|
218
|
+
unless(leaf.is_a?(CollapseArray))
|
219
|
+
leaf = CollapseArray.new.push(leaf)
|
220
|
+
end
|
215
221
|
leaf << (args.size > 1 ? args : args.first)
|
216
222
|
@table[sym] = leaf
|
217
223
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attribute_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Attribute structures
|
14
14
|
email: chrisroberts.code@gmail.com
|