Class: Puppet::Pops::Types::PNotUndefType
Constant Summary
collapse
- DEFAULT =
PNotUndefType.new
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from PAnyType
#assignable?, #callable?, #callable_args?, #enumerable?, #kind_of_callable?, #simple_name, #to_s
Methods included from Visitable
#accept
Constructor Details
Returns a new instance of PNotUndefType.
231
232
233
|
# File 'lib/puppet/pops/types/types.rb', line 231
def initialize(type = nil)
@type = type.class == PAnyType ? nil : type
end
|
Instance Attribute Details
229
230
231
|
# File 'lib/puppet/pops/types/types.rb', line 229
def type
@type
end
|
Instance Method Details
247
248
249
|
# File 'lib/puppet/pops/types/types.rb', line 247
def ==(o)
self.class == o.class && @type == o.type
end
|
#generalize ⇒ Object
239
240
241
|
# File 'lib/puppet/pops/types/types.rb', line 239
def generalize
@type.nil? ? DEFAULT : PNotUndefType.new(type.generalize)
end
|
243
244
245
|
# File 'lib/puppet/pops/types/types.rb', line 243
def hash
31 * @type.hash
end
|
#instance?(o) ⇒ Boolean
235
236
237
|
# File 'lib/puppet/pops/types/types.rb', line 235
def instance?(o)
!(o.nil? || o == :undef) && (@type.nil? || @type.instance?(o))
end
|