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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c738697bb285b4361d0c6ec406b0da76b5a2079
4
- data.tar.gz: db5e19aa6b5652efe0e8573fff51bc4c402fb812
3
+ metadata.gz: 1ccfa3d9862d7b952d4dcc9153a93e1429c1ce69
4
+ data.tar.gz: 071e904281da264dd3f131eba98c0525a50cdc2e
5
5
  SHA512:
6
- metadata.gz: d30383fab69c47327e2b7a6f1e52f909ce8f9228ef88ba1d8ba50a2fbef8228baad2b93ddb499f9de0f5dc0dce5395989cc92bb56abab5b684aa4701273df76d
7
- data.tar.gz: 51bd2f344daf03abeda42b96c55e9d9a24864fb5490ef2d05c6e3b2e4b2e61d9b7fb2cbd9129262d6ecf9b2acad739d54e2c311e9a7a18ee8d387c75bf969910
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({}) { |h, (k, v)| h[k] = openstruct(v); h }
147
- OpenStruct.new(mapped)
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
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Template
3
- VERSION = '1.3262.0'
3
+ VERSION = '1.3262.4.0'
4
4
  end
5
5
  end
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-06-23 00:00:00.000000000 Z
11
+ date: 2016-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semi_semantic