Class: Puppet::Pops::Model::ModelTreeDumper Private

Inherits:
TreeDumper show all
Defined in:
lib/puppet/pops/model/model_tree_dumper.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Dumps a Pops::Model in reverse polish notation; i.e. LISP style The intention is to use this for debugging output TODO: BAD NAME - A DUMP is a Ruby Serialization

Instance Attribute Summary

Attributes inherited from TreeDumper

#indent_count

Instance Method Summary collapse

Methods inherited from TreeDumper

#do_dump, #dump, #format, #format_r, #indent, #initialize

Constructor Details

This class inherits a constructor from Puppet::Pops::Model::TreeDumper

Instance Method Details

#dump_AccessExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

x prints as (slice x y)



44
45
46
47
48
49
50
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 44

def dump_AccessExpression o
  if o.keys.size <= 1
    ["slice", do_dump(o.left_expr), do_dump(o.keys[0])]
  else
    ["slice", do_dump(o.left_expr), do_dump(o.keys)]
  end
end

#dump_AndExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



96
97
98
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 96

def dump_AndExpression o
  ["&&", do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_Application(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



35
36
37
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 35

def dump_Application o
  ["application", o.name, do_dump(o.parameters), do_dump(o.body)]
end

#dump_ArithmeticExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 39

def dump_ArithmeticExpression o
  [o.operator.to_s, do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_Array(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 6

def dump_Array o
  o.collect {|e| do_dump(e) }
end

#dump_AssignmentExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



108
109
110
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 108

def dump_AssignmentExpression o
  [o.operator.to_s, do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_AttributeOperation(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Produces (name => expr) or (name +> expr)



113
114
115
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 113

def dump_AttributeOperation o
  [o.attribute_name, o.operator, do_dump(o.value_expr)]
end

#dump_AttributesOperation(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



117
118
119
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 117

def dump_AttributesOperation o
  ['* =>', do_dump(o.expr)]
end

#dump_BlockExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



198
199
200
201
202
203
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 198

def dump_BlockExpression o
  result = ["block", :indent]
  o.statements.each {|x| result << :break; result << do_dump(x) }
  result << :dedent << :break
  result
end

#dump_CallMethodExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

def dump_CallNamedFunctionExpression o

  result = [o.rval_required ? "call" : "invoke", do_dump(o.functor_expr)]
  o.arguments.collect {|a| result << do_dump(a) }
  result
end


357
358
359
360
361
362
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 357

def dump_CallMethodExpression o
  result = [o.rval_required ? "call-method" : "invoke-method", do_dump(o.functor_expr)]
  o.arguments.collect {|a| result << do_dump(a) }
  result << do_dump(o.lambda) if o.lambda
  result
end

#dump_CallNamedFunctionExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Produces (invoke name args…) when not required to produce an rvalue, and (call name args … ) otherwise.



344
345
346
347
348
349
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 344

def dump_CallNamedFunctionExpression o
  result = [o.rval_required ? "call" : "invoke", do_dump(o.functor_expr)]
  o.arguments.collect {|a| result << do_dump(a) }
  result << do_dump(o.lambda) if o.lambda
  result
end

#dump_CapabilityMapping(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



278
279
280
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 278

def dump_CapabilityMapping o
  [o.kind, do_dump(o.component), o.capability, do_dump(o.mappings)]
end

#dump_CaseExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



364
365
366
367
368
369
370
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 364

def dump_CaseExpression o
  result = ["case", do_dump(o.test), :indent]
  o.options.each do |s|
    result << :break << do_dump(s)
  end
  result << :dedent
end

#dump_CaseOption(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



372
373
374
375
376
377
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 372

def dump_CaseOption o
  result = ["when"]
  result << o.values.collect {|x| do_dump(x) }
  result << ["then", do_dump(o.then_expr) ]
  result
end

#dump_CollectExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



56
57
58
59
60
61
62
63
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 56

def dump_CollectExpression o
  result = ["collect", do_dump(o.type_expr), :indent, :break, do_dump(o.query), :indent]
  o.operations do |ao|
    result << :break << do_dump(ao)
  end
  result += [:dedent, :dedent ]
  result
end

#dump_ComparisonExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



92
93
94
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 92

def dump_ComparisonExpression o
  [o.operator.to_s, do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_ConcatenatedString(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Interpolated strings are shown as (cat seg0 seg1 … segN)



206
207
208
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 206

def dump_ConcatenatedString o
  ["cat"] + o.segments.collect {|x| do_dump(x)}
end

#dump_EppExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



65
66
67
68
69
70
71
72
73
74
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 65

def dump_EppExpression o
  result = ["epp"]
#    result << ["parameters"] + o.parameters.collect {|p| do_dump(p) } if o.parameters.size() > 0
  if o.body
    result << do_dump(o.body)
  else
    result << []
  end
  result
end

#dump_ExportedQuery(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



76
77
78
79
80
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 76

def dump_ExportedQuery o
  result = ["<<| |>>"]
  result += dump_QueryExpression(o) unless is_nop?(o.expr)
  result
end

#dump_Factory(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 31

def dump_Factory o
  do_dump(o.current)
end

#dump_FunctionDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



260
261
262
263
264
265
266
267
268
269
270
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 260

def dump_FunctionDefinition o
  result = ['function', o.name]
  result << ['parameters'] + o.parameters.collect {|p| do_dump(p) } if o.parameters.size() > 0
  result << ['return_type', do_dump(o.return_type)] unless o.return_type.nil?
  if o.body
    result << do_dump(o.body)
  else
    result << []
  end
  result
end

#dump_HeredocExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



210
211
212
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 210

def dump_HeredocExpression(o)
  result = ["@(#{o.syntax})", :indent, :break, do_dump(o.text_expr), :dedent, :break]
end

#dump_HostClassDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



214
215
216
217
218
219
220
221
222
223
224
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 214

def dump_HostClassDefinition o
  result = ["class", o.name]
  result << ["inherits", o.parent_class] if o.parent_class
  result << ["parameters"] + o.parameters.collect {|p| do_dump(p) } if o.parameters.size() > 0
  if o.body
    result << do_dump(o.body)
  else
    result << []
  end
  result
end

#dump_IfExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



321
322
323
324
325
326
327
328
329
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 321

def dump_IfExpression o
  result = ["if", do_dump(o.test), :indent, :break,
    ["then", :indent, do_dump(o.then_expr), :dedent]]
  result +=
  [:break,
    ["else", :indent, do_dump(o.else_expr), :dedent],
    :dedent] unless is_nop? o.else_expr
  result
end

#dump_InExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



104
105
106
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 104

def dump_InExpression o
  ["in", do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_KeyedEntry(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



129
130
131
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 129

def dump_KeyedEntry o
  [do_dump(o.key), do_dump(o.value)]
end

#dump_LambdaExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



141
142
143
144
145
146
147
148
149
150
151
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 141

def dump_LambdaExpression o
  result = ["lambda"]
  result << ["parameters"] + o.parameters.collect {|p| do_dump(p) } if o.parameters.size() > 0
  result << ['return_type', do_dump(o.return_type)] unless o.return_type.nil?
  if o.body
    result << do_dump(o.body)
  else
    result << []
  end
  result
end

#dump_LiteralDefault(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



153
154
155
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 153

def dump_LiteralDefault o
  ":default"
end

#dump_LiteralFloat(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 10

def dump_LiteralFloat o
  o.value.to_s
end

#dump_LiteralHash(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



125
126
127
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 125

def dump_LiteralHash o
  ["{}"] + o.entries.collect {|x| do_dump(x)}
end

#dump_LiteralInteger(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 14

def dump_LiteralInteger o
  case o.radix
  when 10
    o.value.to_s
  when 8
    "0%o" % o.value
  when 16
    "0x%X" % o.value
  else
    "bad radix:" + o.value.to_s
  end
end

#dump_LiteralList(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



121
122
123
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 121

def dump_LiteralList o
  ["[]"] + o.values.collect {|x| do_dump(x)}
end

#dump_LiteralRegularExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



161
162
163
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 161

def dump_LiteralRegularExpression o
  "/#{o.value.source}/"
end

#dump_LiteralString(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



137
138
139
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 137

def dump_LiteralString o
  "'#{o.value}'"
end

#dump_LiteralUndef(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



157
158
159
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 157

def dump_LiteralUndef o
  ":undef"
end

#dump_LiteralValue(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 27

def dump_LiteralValue o
  o.value.to_s
end

#dump_MatchesExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 52

def dump_MatchesExpression o
  [o.operator.to_s, do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_MatchExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



133
134
135
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 133

def dump_MatchExpression o
  [o.operator.to_s, do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_NamedAccessExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



169
170
171
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 169

def dump_NamedAccessExpression o
  [".", do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_NamedDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



248
249
250
251
252
253
254
255
256
257
258
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 248

def dump_NamedDefinition o
  # the nil must be replaced with a string
  result = [nil, o.name]
  result << ["parameters"] + o.parameters.collect {|p| do_dump(p) } if o.parameters.size() > 0
  if o.body
    result << do_dump(o.body)
  else
    result << []
  end
  result
end

#dump_NilClass(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



173
174
175
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 173

def dump_NilClass o
  "()"
end

#dump_NodeDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



226
227
228
229
230
231
232
233
234
235
236
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 226

def dump_NodeDefinition o
  result = ["node"]
  result << ["matches"] + o.host_matches.collect {|m| do_dump(m) }
  result << ["parent", do_dump(o.parent)] if o.parent
  if o.body
    result << do_dump(o.body)
  else
    result << []
  end
  result
end

#dump_Nop(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



165
166
167
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 165

def dump_Nop o
  ":nop"
end

#dump_NotExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



177
178
179
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 177

def dump_NotExpression o
  ['!', dump(o.expr)]
end

#dump_Object(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



444
445
446
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 444

def dump_Object o
  [o.class.to_s, o.to_s]
end

#dump_OrExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



100
101
102
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 100

def dump_OrExpression o
  ["||", do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_Parameter(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Produces parameters as name, or (= name value)



297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 297

def dump_Parameter o
  name_prefix = o.captures_rest ? '*' : ''
  name_part = "#{name_prefix}#{o.name}"
  if o.value && o.type_expr
    ["=t", do_dump(o.type_expr), name_part, do_dump(o.value)]
  elsif o.value
    ["=", name_part, do_dump(o.value)]
  elsif o.type_expr
    ["t", do_dump(o.type_expr), name_part]
  else
    name_part
  end
end

#dump_ParenthesizedExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



311
312
313
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 311

def dump_ParenthesizedExpression o
  do_dump(o.expr)
end

#dump_Program(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Hides that Program exists in the output (only its body is shown), the definitions are just references to contained classes, resource types, and nodes



317
318
319
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 317

def dump_Program(o)
  dump(o.body)
end

#dump_QueryExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



88
89
90
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 88

def dump_QueryExpression o
  [do_dump(o.expr)]
end

#dump_RelationshipExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



379
380
381
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 379

def dump_RelationshipExpression o
  [o.operator.to_s, do_dump(o.left_expr), do_dump(o.right_expr)]
end

#dump_RenderExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



387
388
389
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 387

def dump_RenderExpression o
  ["render", do_dump(o.expr)]
end

#dump_RenderStringExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



383
384
385
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 383

def dump_RenderStringExpression o
  ["render-s", " '#{o.value}'"]
end

#dump_ReservedWord(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



292
293
294
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 292

def dump_ReservedWord o
  [ 'reserved', o.word ]
end

#dump_ResourceBody(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



391
392
393
394
395
396
397
398
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 391

def dump_ResourceBody o
  result = [do_dump(o.title), :indent]
  o.operations.each do |p|
    result << :break << do_dump(p)
  end
  result << :dedent
  result
end

#dump_ResourceDefaultsExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



400
401
402
403
404
405
406
407
408
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 400

def dump_ResourceDefaultsExpression o
  form = o.form == :regular ? '' : o.form.to_s + "-"
  result = [form+"resource-defaults", do_dump(o.type_ref), :indent]
  o.operations.each do |p|
    result << :break << do_dump(p)
  end
  result << :dedent
  result
end

#dump_ResourceExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



410
411
412
413
414
415
416
417
418
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 410

def dump_ResourceExpression o
  form = o.form == :regular ? '' : o.form.to_s + "-"
  result = [form+"resource", do_dump(o.type_name), :indent]
  o.bodies.each do |b|
    result << :break << do_dump(b)
  end
  result << :dedent
  result
end

#dump_ResourceOverrideExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



282
283
284
285
286
287
288
289
290
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 282

def dump_ResourceOverrideExpression o
  form = o.form == :regular ? '' : o.form.to_s + "-"
  result = [form+"override", do_dump(o.resources), :indent]
  o.operations.each do |p|
    result << :break << do_dump(p)
  end
  result << :dedent
  result
end

#dump_ResourceTypeDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



272
273
274
275
276
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 272

def dump_ResourceTypeDefinition o
  result = dump_NamedDefinition(o)
  result[0] = 'define'
  result
end

#dump_SelectorEntry(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



424
425
426
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 424

def dump_SelectorEntry o
  [do_dump(o.matching_expr), "=>", do_dump(o.value_expr)]
end

#dump_SelectorExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



420
421
422
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 420

def dump_SelectorExpression o
  ["?", do_dump(o.left_expr)] + o.selectors.collect {|x| do_dump(x) }
end

#dump_SiteDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



238
239
240
241
242
243
244
245
246
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 238

def dump_SiteDefinition o
  result = ["site"]
  if o.body
    result << do_dump(o.body)
  else
    result << []
  end
  result
end

#dump_SubLocatedExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



428
429
430
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 428

def dump_SubLocatedExpression o
  ["sublocated", do_dump(o.expr)]
end

#dump_TextExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Interpolation (to string) shown as (str expr)



186
187
188
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 186

def dump_TextExpression o
  ["str", do_dump(o.expr)]
end

#dump_TypeAlias(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



432
433
434
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 432

def dump_TypeAlias(o)
  ['type-alias', o.name, do_dump(o.type_expr)]
end

#dump_TypeDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



440
441
442
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 440

def dump_TypeDefinition(o)
  ['type-definition', o.name, o.parent, do_dump(o.body)]
end

#dump_TypeMapping(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



436
437
438
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 436

def dump_TypeMapping(o)
  ['type-mapping', do_dump(o.type_expr), do_dump(o.mapping_expr)]
end

#dump_UnaryMinusExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



190
191
192
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 190

def dump_UnaryMinusExpression o
  ['-', do_dump(o.expr)]
end

#dump_UnfoldExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



194
195
196
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 194

def dump_UnfoldExpression o
  ['unfold', do_dump(o.expr)]
end

#dump_UnlessExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



331
332
333
334
335
336
337
338
339
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 331

def dump_UnlessExpression o
  result = ["unless", do_dump(o.test), :indent, :break,
    ["then", :indent, do_dump(o.then_expr), :dedent]]
  result +=
  [:break,
    ["else", :indent, do_dump(o.else_expr), :dedent],
    :dedent] unless is_nop? o.else_expr
  result
end

#dump_VariableExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



181
182
183
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 181

def dump_VariableExpression o
  "$#{dump(o.expr)}"
end

#dump_VirtualQuery(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



82
83
84
85
86
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 82

def dump_VirtualQuery o
  result = ["<| |>"]
  result += dump_QueryExpression(o) unless is_nop?(o.expr)
  result
end

#is_nop?(o) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


448
449
450
# File 'lib/puppet/pops/model/model_tree_dumper.rb', line 448

def is_nop? o
  o.nil? || o.is_a?(Puppet::Pops::Model::Nop)
end