Method: Puppet::Pops::Types::TypeFactory.optional
- Defined in:
- lib/puppet/pops/types/type_factory.rb
.optional(optional_type = nil) ⇒ POptionalType
Produces the Optional type, i.e. a short hand for Variant[T, Undef] If the given ‘optional_type’ argument is a String, then it will be converted into a String type that represents that string.
133 134 135 136 137 138 139 |
# File 'lib/puppet/pops/types/type_factory.rb', line 133 def self.optional(optional_type = nil) if optional_type.nil? POptionalType::DEFAULT else POptionalType.new(type_of(optional_type.is_a?(String) ? string(optional_type) : type_of(optional_type))) end end |