attribute_struct 0.2.22 → 0.2.24

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: b824f9b0f1c12f9d33cf496af7d88899dc9634e7
4
- data.tar.gz: 1a6e058a77f4ebc0189a8367b56797208519ed1c
3
+ metadata.gz: 1851f044804aa76edf2e80c3b6544b947c9f2b0a
4
+ data.tar.gz: 4034992ed7b20c3bee4f817b3cc3bdceeb8eade1
5
5
  SHA512:
6
- metadata.gz: 73056b0aaf9645e3a51db712dd5d4351483760135a26e395fa4170e507bb21c8488f3fdb1eb816a9e1e5a29a925c89a553fd596dacb339f5cef9ab2b7c8bb25d
7
- data.tar.gz: 3350700bcd1745bf4ffa03d5f25b840ea7908dd554a50cb147ac2e9d2cf31a401e20e68780974d11ea21027359ac42ae5e2b1c208bc6a811609bc488aa2bd13f
6
+ metadata.gz: 6402258e7f98e8c8918397441c6aced1e842214a4c1b97ad76b27de92c95b6c3449b42992619d4166e8cc82ff83c4bce36472c4c637079313590083acb1a4744
7
+ data.tar.gz: 9036ca42dc57baa17bb8489016e0f2f1e630c87ab3aafe697e3086d485afce76ac8045ea45941fdd2e0890fac1849a2ba7d92e5edc9aa35c0c33e90a409b9f87
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.2.24
2
+ * Fix `#_root` helper to properly check for parent
3
+ * Always use the `#_klass_new` helper
4
+ * Support optional arguments/block to `#_klass_new`
5
+
1
6
  ## v0.2.22
2
7
  * Add more helper method bang aliases
3
8
  * Properly persist camel data on Hash keys
@@ -322,7 +322,7 @@ class AttributeStruct < BasicObject
322
322
  hashish.each do |key, value|
323
323
  if(value.is_a?(::Enumerable))
324
324
  flat = value.map do |v|
325
- v.is_a?(::Hash) ? _klass.new(v) : v
325
+ v.is_a?(::Hash) ? _klass_new(v) : v
326
326
  end
327
327
  value = value.is_a?(::Hash) ? __hashish[*flat.flatten(1)] : flat
328
328
  end
@@ -344,7 +344,7 @@ class AttributeStruct < BasicObject
344
344
  source = _deep_copy
345
345
  dest = overlay._deep_copy
346
346
  result = source.deep_merge(dest)
347
- _klass.new(result)
347
+ _klass_new(result)
348
348
  end
349
349
 
350
350
  # Perform deep merge in place
@@ -427,8 +427,8 @@ class AttributeStruct < BasicObject
427
427
 
428
428
  # @return [AttributeStruct] new struct instance
429
429
  # @note will set self as parent and propogate camelizing status
430
- def _klass_new
431
- n = _klass.new
430
+ def _klass_new(*args, &block)
431
+ n = _klass.new(*args, &block)
432
432
  unless(_camel_keys_action == :auto_discovery)
433
433
  n._camel_keys_set(_camel_keys_action)
434
434
  end
@@ -461,7 +461,7 @@ class AttributeStruct < BasicObject
461
461
  # @return [AttributeStruct, NilClass] root of the struct or nil if self is root
462
462
  def _root
463
463
  r = self
464
- until(r._parent.nil?)
464
+ until(r._parent == nil)
465
465
  r = r._parent
466
466
  end
467
467
  r
@@ -2,5 +2,5 @@ require 'attribute_struct/attribute_struct'
2
2
 
3
3
  class AttributeStruct
4
4
  # Current library version
5
- VERSION = ::Gem::Version.new('0.2.22')
5
+ VERSION = ::Gem::Version.new('0.2.24')
6
6
  end
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.22
4
+ version: 0.2.24
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-09-01 00:00:00.000000000 Z
11
+ date: 2015-11-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Attribute structures
14
14
  email: chrisroberts.code@gmail.com
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  version: '0'
48
48
  requirements: []
49
49
  rubyforge_project:
50
- rubygems_version: 2.2.2
50
+ rubygems_version: 2.4.8
51
51
  signing_key:
52
52
  specification_version: 4
53
53
  summary: Attribute structures