Class: Puppet::Pops::Types::PScalarType
- Inherits:
-
PAnyType
- Object
- TypedModelObject
- PAnyType
- Puppet::Pops::Types::PScalarType
- Defined in:
- lib/puppet/pops/types/types.rb
Overview
Type that is PDataType compatible, but is not a PCollectionType.
Direct Known Subclasses
PAbstractRangeType, PBooleanType, PEnumType, PPatternType, PRegexpType, PSemVerRangeType, PSemVerType, PStringType
Constant Summary collapse
- DEFAULT =
PScalarType.new
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from PAnyType
#==, #accept, #assignable?, #callable?, #callable_args?, #callable_with?, #check_self_recursion, #create, #eql?, #generalize, #hash, #iterable?, #iterable_type, #kind_of_callable?, #name, #new_function, new_function, #normalize, #really_instance?, #resolve, #simple_name, simple_name, #to_alias_expanded_s, #to_s
Methods inherited from TypedModelObject
_ptype, create_ptype, register_ptypes
Methods included from Visitable
Methods included from PuppetObject
Class Method Details
.register_ptype(loader, ir) ⇒ Object
680 681 682 |
# File 'lib/puppet/pops/types/types.rb', line 680 def self.register_ptype(loader, ir) create_ptype(loader, ir, 'AnyType') end |
Instance Method Details
#instance?(o, guard = nil) ⇒ Boolean
684 685 686 687 688 689 690 691 692 |
# File 'lib/puppet/pops/types/types.rb', line 684 def instance?(o, guard = nil) if o.is_a?(String) || o.is_a?(Numeric) || o.is_a?(TrueClass) || o.is_a?(FalseClass) || o.is_a?(Regexp) || o.is_a?(SemanticPuppet::VersionRange) true elsif o.is_a?(Array) || o.is_a?(Hash) || o.is_a?(PAnyType) || o.is_a?(NilClass) false else assignable?(TypeCalculator.infer(o)) end end |