Class: Puppet::Pops::Types::PIteratorType

Inherits:
PTypeWithContainedType show all
Defined in:
lib/puppet/pops/types/types.rb

Overview

API:

  • public

Constant Summary collapse

DEFAULT =

API:

  • public

PIteratorType.new(nil)

Instance Attribute Summary

Attributes inherited from PTypeWithContainedType

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PTypeWithContainedType

#accept, #eql?, #generalize, #hash, #initialize, #normalize, #resolve

Methods inherited from PAnyType

#==, #accept, #assignable?, #callable?, #callable_args?, #check_self_recursion, #create, #eql?, #generalize, #hash, #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

#accept

Methods included from PuppetObject

#_ptype

Constructor Details

This class inherits a constructor from Puppet::Pops::Types::PTypeWithContainedType

Class Method Details

.register_ptype(loader, ir) ⇒ Object

API:

  • public



1314
1315
1316
1317
1318
1319
1320
1321
# File 'lib/puppet/pops/types/types.rb', line 1314

def self.register_ptype(loader, ir)
  create_ptype(loader, ir, 'AnyType',
    'type' => {
      KEY_TYPE => POptionalType.new(PType::DEFAULT),
      KEY_VALUE => nil
    }
  )
end

Instance Method Details

#element_typeObject

API:

  • public



1323
1324
1325
# File 'lib/puppet/pops/types/types.rb', line 1323

def element_type
  @type
end

#instance?(o, guard = nil) ⇒ Boolean

Returns:

API:

  • public



1327
1328
1329
# File 'lib/puppet/pops/types/types.rb', line 1327

def instance?(o, guard = nil)
  o.is_a?(Iterable) && (@type.nil? || @type.assignable?(o.element_type, guard))
end

#iterable?(guard = nil) ⇒ Boolean

Returns:

API:

  • public



1331
1332
1333
# File 'lib/puppet/pops/types/types.rb', line 1331

def iterable?(guard = nil)
  true
end

#iterable_type(guard = nil) ⇒ Object

API:

  • public



1335
1336
1337
# File 'lib/puppet/pops/types/types.rb', line 1335

def iterable_type(guard = nil)
  @type.nil? ? PIterableType::DEFAULT : PIterableType.new(@type)
end