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



208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 208

def self.convert_return(val3x)
  case val3x
  when :undef
    nil
  when Array
    val3x.map { |v| convert_return(v) }
  when 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.



191
192
193
194
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 191

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.



175
176
177
178
179
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 175

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.



196
197
198
199
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 196

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.



201
202
203
204
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 201

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.



181
182
183
184
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 181

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.



186
187
188
189
# File 'lib/puppet/pops/evaluator/runtime3_converter.rb', line 186

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