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

API:

  • private

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

API:

  • private



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

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.

API:

  • private



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

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.

API:

  • private



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

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.

API:

  • private



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

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.

API:

  • private



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

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.

API:

  • private



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

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.

API:

  • private



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

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