bosh-template 1.3262.0 → 1.3262.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bosh/template/evaluation_context.rb +19 -5
- data/lib/bosh/template/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: 1ccfa3d9862d7b952d4dcc9153a93e1429c1ce69
|
4
|
+
data.tar.gz: 071e904281da264dd3f131eba98c0525a50cdc2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e06c5ac979cbb2e3c04940c8f86424642e1525ed8899e4c5424f6a5091bc963020eaa433aa8cfc1a33d62174abdb784c4b5575d1f30646295413a3c7b08471ab
|
7
|
+
data.tar.gz: a0f46ae29fbbabb8183f7f245f4c0aafe22b1668d044dcff2f44abdf63f53798205008d1e7c6f36d04fd1fe4921870e5cdaf610951a455cb3666982c5b46270a
|
@@ -42,7 +42,7 @@ module Bosh
|
|
42
42
|
end
|
43
43
|
|
44
44
|
@index = spec['index']
|
45
|
-
@spec = openstruct(spec)
|
45
|
+
@spec = openstruct(spec, BackCompatOpenStruct)
|
46
46
|
@raw_properties = spec['properties'] || {}
|
47
47
|
@properties = openstruct(@raw_properties)
|
48
48
|
|
@@ -137,21 +137,35 @@ module Bosh
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
+
private
|
141
|
+
|
140
142
|
# @return [Object] Object representation where all hashes are unrolled
|
141
143
|
# into OpenStruct objects. This exists mostly for backward
|
142
144
|
# compatibility, as it doesn't provide good error reporting.
|
143
|
-
def openstruct(object)
|
145
|
+
def openstruct(object, open_struct_klass=OpenStruct)
|
144
146
|
case object
|
145
147
|
when Hash
|
146
|
-
mapped = object.inject({})
|
147
|
-
|
148
|
+
mapped = object.inject({}) do |h, (k, v)|
|
149
|
+
h[k] = openstruct(v, open_struct_klass); h
|
150
|
+
end
|
151
|
+
open_struct_klass.new(mapped)
|
148
152
|
when Array
|
149
|
-
object.map { |item| openstruct(item) }
|
153
|
+
object.map { |item| openstruct(item, open_struct_klass) }
|
150
154
|
else
|
151
155
|
object
|
152
156
|
end
|
153
157
|
end
|
154
158
|
|
159
|
+
class BackCompatOpenStruct < OpenStruct
|
160
|
+
def methods(regular=true)
|
161
|
+
if regular
|
162
|
+
super(regular)
|
163
|
+
else
|
164
|
+
to_h.keys.map(&:to_sym)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
155
169
|
class ActiveElseBlock
|
156
170
|
def initialize(template_context)
|
157
171
|
@context = template_context
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3262.0
|
4
|
+
version: 1.3262.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pivotal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semi_semantic
|