Class: Puppet::Pops::Evaluator::Runtime3FunctionArgumentConverter Private

Inherits:
Runtime3Converter show all
Defined in:
lib/puppet/pops/evaluator/runtime3_converter.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.

A Ruby function written for the 3.x API cannot be expected to handle extended data types. This converter ensures that they are converted to String format

Constant Summary

Constants inherited from Runtime3Converter

Puppet::Pops::Evaluator::Runtime3Converter::MAX_INTEGER, Puppet::Pops::Evaluator::Runtime3Converter::MIN_INTEGER

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Runtime3Converter

#catalog_type_to_split_type_title, convert, #convert, #convert_Array, #convert_BigDecimal, #convert_Hash, #convert_Integer, #convert_Iterator, #convert_NilClass, #convert_Object, #convert_PAnyType, #convert_PCatalogEntryType, #convert_String, #convert_Symbol, instance, #map_args, map_args

Class Method Details

.convert_return(val3x) ⇒ 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.

Converts result back to 4.x by replacing :undef with nil in Array and Hash objects



205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 205

def self.convert_return(val3x)
  if val3x == :undef
    nil
  elsif val3x.is_a?(Array)
    val3x.map {|v| convert_return(v) }
  elsif val3x.is_a?(Hash)
    hsh = {}
    val3x.each_pair {|k,v| hsh[convert_return(k)] = convert_return(v)}
    hsh
  else
    val3x
  end
end

Instance Method Details

#convert_Binary(o, scope, undef_value) ⇒ 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.



188
189
190
191
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 188

def convert_Binary(o, scope, undef_value)
  # Puppet 3x cannot handle Binary. Use the string form
  o.to_s
end

#convert_Regexp(o, scope, undef_value) ⇒ 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.



172
173
174
175
176
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 172

def convert_Regexp(o, scope, undef_value)
  # Puppet 3x cannot handle parameter values that are regular expressions. Turn into regexp string in
  # source form
  o.inspect
end

#convert_Timespan(o, scope, undef_value) ⇒ 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.



193
194
195
196
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 193

def convert_Timespan(o, scope, undef_value)
  # Puppet 3x cannot handle Timespans. Use the string form
  o.to_s
end

#convert_Timestamp(o, scope, undef_value) ⇒ 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
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 198

def convert_Timestamp(o, scope, undef_value)
  # Puppet 3x cannot handle Timestamps. Use the string form
  o.to_s
end

#convert_Version(o, scope, undef_value) ⇒ 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.



178
179
180
181
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 178

def convert_Version(o, scope, undef_value)
  # Puppet 3x cannot handle SemVers. Use the string form
  o.to_s
end

#convert_VersionRange(o, scope, undef_value) ⇒ 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.



183
184
185
186
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 183

def convert_VersionRange(o, scope, undef_value)
  # Puppet 3x cannot handle SemVerRanges. Use the string form
  o.to_s
end