+ Note: Since Puppet 4.5.0 this can be done with String.new() and its many formatting options:
+
+ $binary_repr = String(5, '%b') # results in "101"
+ $hex_repr = String(254, "%x") # results in "fe"
+ $hex_repr = String(254, "%#x") # results in "0xfe"
+ DOC