Class: Puppet::Pops::Types::PType
Overview
Constant Summary
collapse
- DEFAULT =
PType.new(nil)
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from PAnyType
#assignable?, #callable?, #callable_args?, #enumerable?, #kind_of_callable?, #to_s
Methods included from Visitable
#accept
Constructor Details
#initialize(type) ⇒ PType
Returns a new instance of PType.
186
187
188
|
# File 'lib/puppet/pops/types/types.rb', line 186
def initialize(type)
@type = type
end
|
Instance Attribute Details
184
185
186
|
# File 'lib/puppet/pops/types/types.rb', line 184
def type
@type
end
|
Instance Method Details
206
207
208
|
# File 'lib/puppet/pops/types/types.rb', line 206
def ==(o)
self.class == o.class && @type == o.type
end
|
#generalize ⇒ Object
198
199
200
|
# File 'lib/puppet/pops/types/types.rb', line 198
def generalize
@type.nil? ? DEFAULT : PType.new(type.generalize)
end
|
202
203
204
|
# File 'lib/puppet/pops/types/types.rb', line 202
def hash
31 * @type.hash
end
|
#instance?(o) ⇒ Boolean
190
191
192
193
194
195
196
|
# File 'lib/puppet/pops/types/types.rb', line 190
def instance?(o)
if o.is_a?(PAnyType)
type.nil? || type.assignable?(o)
else
assignable?(TypeCalculator.infer(o))
end
end
|
#simple_name ⇒ Object
210
211
212
213
|
# File 'lib/puppet/pops/types/types.rb', line 210
def simple_name
'Type'
end
|