Method: Puppet::Pops::Types::TypeParser.opt_type_map

Defined in:
lib/puppet/pops/types/type_parser.rb

.opt_type_mapObject

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.



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/puppet/pops/types/type_parser.rb', line 213

def self.opt_type_map
  # Map of common (and simple to optimize) data types in string form
  # (Note that some types are the result of evaluation even if they appear to be simple
  # - for example 'Data' and they cannot be optimized this way since the factory calls
  # back to the parser for evaluation).
  #
  @opt_type_map ||= {
    'Integer' => TypeFactory.integer,
    'Float' => TypeFactory.float,
    'Numeric' => TypeFactory.numeric,

    'String' => TypeFactory.string,
    'String[1]' => TypeFactory.string(TypeFactory.range(1, :default)),

    'Binary' => TypeFactory.binary,

    'Boolean' => TypeFactory.boolean,
    'Boolean[true]' => TypeFactory.boolean(true),
    'Boolean[false]' => TypeFactory.boolean(false),

    'Array' => TypeFactory.array_of_any,
    'Array[1]' => TypeFactory.array_of(TypeFactory.any, TypeFactory.range(1, :default)),

    'Hash' => TypeFactory.hash_of_any,
    'Collection' => TypeFactory.collection,
    'Scalar' => TypeFactory.scalar,

    'Scalardata' => TypeFactory.scalar_data,
    'ScalarData' => TypeFactory.scalar_data,

    'Catalogentry' => TypeFactory.catalog_entry,
    'CatalogEntry' => TypeFactory.catalog_entry,

    'Undef' => TypeFactory.undef,
    'Default' => TypeFactory.default,
    'Any' => TypeFactory.any,
    'Type' => TypeFactory.type_type,
    'Callable' => TypeFactory.all_callables,

    'Semver' => TypeFactory.sem_ver,
    'SemVer' => TypeFactory.sem_ver,

    'Semverrange' => TypeFactory.sem_ver_range,
    'SemVerRange' => TypeFactory.sem_ver_range,

    'Timestamp' => TypeFactory.timestamp,
    'TimeStamp' => TypeFactory.timestamp,

    'Timespan' => TypeFactory.timespan,
    'TimeSpan' => TypeFactory.timespan,

    'Uri' => TypeFactory.uri,
    'URI' => TypeFactory.uri,

    'Optional[Integer]' => TypeFactory.optional(TypeFactory.integer),
    'Optional[String]' => TypeFactory.optional(TypeFactory.string),
    'Optional[String[1]]' => TypeFactory.optional(TypeFactory.string(TypeFactory.range(1, :default))),
    'Optional[Array]' => TypeFactory.optional(TypeFactory.array_of_any),
    'Optional[Hash]' => TypeFactory.optional(TypeFactory.hash_of_any),

  }.freeze
end