occi-core 5.0.0.beta.6 → 5.0.0.beta.7

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: aa9a61e70441d1bb4ab60fab3f894e2d3086c1f9
4
- data.tar.gz: f8ecee4038e193c81a46dd410e474e8e82f4eaaa
3
+ metadata.gz: 1645f66b7dfc09fb86c8aad566dbc5ce22f674a1
4
+ data.tar.gz: 8090d0663be19753429b213a39b23ab21b8f0c6f
5
5
  SHA512:
6
- metadata.gz: fc42e510f55fb2f60baaeef56e223bc4d4a4e70f6e715a5e8dae91ed63bef410120a43ca56620eb53656c8aa65ed9fda11e4a06d6dcc48823c854482115de128
7
- data.tar.gz: 56318eebcada2880af308767c224f362e03a514c743bd0ba1f3963467269a5f1aafd04b74f52d2acc935547a6e58fa9f0f6cebb51a95f66b0592765335e92896
6
+ metadata.gz: 6a670675c314346521bf3f4e0ff8a00b3287e3f273344bd075456fc48e0473f6ce66e8e71d7a26ca2b44c642e03633f0690456be8c9adf4f188534fb7c3468c6
7
+ data.tar.gz: b0202c952fb37d2177d1fa4bb00e55de035c588713009df030741d244c556e2e6c540d95656caecc96eb68a26fd0a3ec967a545229920a958647d9336556f826
@@ -59,6 +59,8 @@ module Occi
59
59
  new_attributes = {}
60
60
  self[:attributes].each do |attribute|
61
61
  new_attributes[attribute] = dereference_via_hash(attribute, attribute_definitions)
62
+ next unless fetch(:attribute_defaults, {})[attribute]
63
+ new_attributes[attribute].default = self[:attribute_defaults][attribute]
62
64
  end
63
65
  self[:attributes] = new_attributes
64
66
 
@@ -132,14 +134,15 @@ module Occi
132
134
  end
133
135
 
134
136
  # Looks up the given attribute definition in the hash. Raises error if no
135
- # such attribute definition is found.
137
+ # such attribute definition is found. The prevent future changes from affecting
138
+ # new lookups, located definitions are cloned before they are returned.
136
139
  #
137
140
  # @param identifier [String] attribute identifier (name)
138
141
  # @param hash [Hash] hash with known attribute definitions for dereferencing
139
- # @return [Occi::Core::AttributeDefinition] definition located in the hash
142
+ # @return [Occi::Core::AttributeDefinition] definition located in the hash, cloned
140
143
  def dereference_via_hash(identifier, hash)
141
144
  raise "Attribute definition #{identifier.inspect} not found in the hash" unless hash[identifier]
142
- hash[identifier]
145
+ hash[identifier].clone
143
146
  end
144
147
 
145
148
  private :dereference_via_hash, :dereference_via_model
@@ -3,7 +3,7 @@ module Occi
3
3
  MAJOR_VERSION = 5 # Major update constant
4
4
  MINOR_VERSION = 0 # Minor update constant
5
5
  PATCH_VERSION = 0 # Patch/Fix version constant
6
- STAGE_VERSION = 'beta.6'.freeze # use `nil` for production releases
6
+ STAGE_VERSION = 'beta.7'.freeze # use `nil` for production releases
7
7
 
8
8
  unless defined?(::Occi::Core::VERSION)
9
9
  VERSION = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occi-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.beta.6
4
+ version: 5.0.0.beta.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Parak
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-07-17 00:00:00.000000000 Z
13
+ date: 2017-07-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json