Class: Puppet::Pops::Types::PObjectType
- Inherits:
-
PMetaType
- Object
- TypedModelObject
- PAnyType
- PMetaType
- Puppet::Pops::Types::PObjectType
- Defined in:
- lib/puppet/pops/types/p_object_type.rb
Defined Under Namespace
Classes: PAnnotatedMember, PAttribute, PFunction
Constant Summary collapse
- ATTRIBUTE_KIND_CONSTANT =
'constant'.freeze
- ATTRIBUTE_KIND_DERIVED =
'derived'.freeze
- ATTRIBUTE_KIND_GIVEN_OR_DERIVED =
'given_or_derived'.freeze
- TYPE_ATTRIBUTE_KIND =
TypeFactory.enum(ATTRIBUTE_KIND_CONSTANT, ATTRIBUTE_KIND_DERIVED, ATTRIBUTE_KIND_GIVEN_OR_DERIVED)
- TYPE_OBJECT_NAME =
Pcore::TYPE_QUALIFIED_REFERENCE
- TYPE_MEMBER_NAME =
PPatternType.new([PRegexpType.new(Patterns::PARAM_NAME)])
- TYPE_ATTRIBUTE =
TypeFactory.struct({ KEY_TYPE => PType::DEFAULT, KEY_ANNOTATIONS => TypeFactory.optional(TYPE_ANNOTATIONS), KEY_FINAL => TypeFactory.optional(PBooleanType::DEFAULT), KEY_OVERRIDE => TypeFactory.optional(PBooleanType::DEFAULT), KEY_KIND => TypeFactory.optional(TYPE_ATTRIBUTE_KIND), KEY_VALUE => PAnyType::DEFAULT })
- TYPE_ATTRIBUTES =
TypeFactory.hash_kv(TYPE_MEMBER_NAME, TypeFactory.not_undef)
- TYPE_ATTRIBUTE_CALLABLE =
TypeFactory.callable(0,0)
- TYPE_FUNCTION_TYPE =
PType.new(PCallableType::DEFAULT)
- TYPE_FUNCTION =
TypeFactory.struct({ KEY_TYPE => TYPE_FUNCTION_TYPE, KEY_ANNOTATIONS => TypeFactory.optional(TYPE_ANNOTATIONS), KEY_FINAL => TypeFactory.optional(PBooleanType::DEFAULT), KEY_OVERRIDE => TypeFactory.optional(PBooleanType::DEFAULT) })
- TYPE_FUNCTIONS =
TypeFactory.hash_kv(TYPE_MEMBER_NAME, TypeFactory.not_undef)
- TYPE_EQUALITY =
TypeFactory.variant(TYPE_MEMBER_NAME, TypeFactory.array_of(TYPE_MEMBER_NAME))
- TYPE_CHECKS =
TBD
PAnyType::DEFAULT
- TYPE_OBJECT_I12N =
TypeFactory.struct({ KEY_NAME => TypeFactory.optional(TYPE_OBJECT_NAME), KEY_PARENT => TypeFactory.optional(PType::DEFAULT), KEY_ATTRIBUTES => TypeFactory.optional(TYPE_ATTRIBUTES), KEY_FUNCTIONS => TypeFactory.optional(TYPE_FUNCTIONS), KEY_EQUALITY => TypeFactory.optional(TYPE_EQUALITY), KEY_EQUALITY_INCLUDE_TYPE => TypeFactory.optional(PBooleanType::DEFAULT), KEY_CHECKS => TypeFactory.optional(TYPE_CHECKS), KEY_ANNOTATIONS => TypeFactory.optional(TYPE_ANNOTATIONS) })
- DEFAULT =
PObjectType.new(EMPTY_HASH)
Constants included from Annotatable
Annotatable::TYPE_ANNOTATIONS, Annotatable::TYPE_ANNOTATION_KEY_TYPE, Annotatable::TYPE_ANNOTATION_VALUE_TYPE
Instance Attribute Summary collapse
- #annotations ⇒ Object readonly
-
#attributes(include_parent = false) ⇒ Hash{String=>PAttribute}
readonly
Returns the attributes of this ‘Object` type.
- #checks ⇒ Object readonly
- #equality ⇒ Object readonly
-
#functions(include_parent = false) ⇒ Hash{String=>PFunction}
readonly
Returns the functions of this ‘Object` type.
- #name ⇒ Object readonly
- #parent ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #[](name) ⇒ Object
- #accept(visitor, guard) ⇒ Object
- #attr_reader_name(se) ⇒ Object private
- #callable_args?(callable, guard) ⇒ Boolean
-
#check_self_recursion(originator) ⇒ Object
private
Assert that this type does not inherit from itself.
-
#create_i12n_type ⇒ PStructType
private
Creates the type that a initialization hash used for creating instances of this type must conform to.
- #create_new_function(loader) ⇒ Object private
- #eql?(o) ⇒ Boolean
-
#equality_attributes ⇒ Hash{String=>PAttribute}
Returns the attributes that participate in equality comparison.
-
#equality_include_type? ⇒ Boolean
‘true` if this type is included when comparing instances.
- #hash ⇒ Object
-
#i12n_hash(include_name = true) ⇒ Hash{String=>Object}
The i12n_hash is primarily intended for serialization and string representation purposes.
-
#i12n_type ⇒ PStructType
Returns the type that a initialization hash used for creating instances of this type must conform to.
- #implementation_class ⇒ Object private
- #include_class_in_equality? ⇒ Boolean private
-
#initialize(name_or_i12n_hash, i12n_hash_expression = nil) ⇒ PObjectType
constructor
private
Initialize an Object Type instance.
- #initialize_from_hash(i12n_hash) ⇒ Object private
- #instance?(o, guard = nil) ⇒ Boolean
- #iterable?(guard = nil) ⇒ Boolean
- #iterable_type(guard = nil) ⇒ Object
- #kind_of_callable?(optional = true, guard = nil) ⇒ Boolean
- #label ⇒ Object private
-
#members(include_parent = false) ⇒ Hash{String=>PAnnotatedMember}
Returns the members (attributes and functions) of this ‘Object` type.
- #new_function(loader) ⇒ Object private
-
#parameter_info(attr_readers = false) ⇒ (Array<String>, Array<PAnyType>, Integer)
private
Array of parameter names, array of parameter types, and a count reflecting the required number of parameters.
-
#read(value_count, deserializer) ⇒ Object
private
Read an instance of this type from a deserializer.
-
#reader=(reader) ⇒ Object
private
Assign a new instance reader to this type.
- #resolved_parent ⇒ Object private
-
#write(value, serializer) ⇒ Object
private
Write an instance of this type using a serializer.
-
#writer=(writer) ⇒ Object
private
Assign a new instance write to this type.
Methods inherited from PMetaType
#resolve, #resolve_hash, #resolve_literal_hash, #resolve_type_refs, #to_s
Methods included from Annotatable
#annotatable_accept, #init_annotatable
Methods inherited from PAnyType
#==, #assignable?, #callable?, #generalize, 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 PuppetObject
Constructor Details
#initialize(name, i12n_hash_expression) ⇒ PObjectType #initialize(i12n_hash) ⇒ PObjectType
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize an Object Type instance. The initialization will use either a name and an initialization hash expression, or a fully resolved initialization hash.
361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 361 def initialize(name_or_i12n_hash, i12n_hash_expression = nil) @attributes = EMPTY_HASH @functions = EMPTY_HASH if name_or_i12n_hash.is_a?(Hash) initialize_from_hash(name_or_i12n_hash) else @name = TypeAsserter.assert_instance_of('object name', TYPE_OBJECT_NAME, name_or_i12n_hash) @i12n_hash_expression = i12n_hash_expression end end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
343 344 345 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 343 def annotations @annotations end |
#attributes(include_parent = false) ⇒ Hash{String=>PAttribute} (readonly)
Returns the attributes of this ‘Object` type. If include_parent is `true`, then all inherited attributes will be included in the returned `Hash`.
703 704 705 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 703 def attributes @attributes end |
#checks ⇒ Object (readonly)
342 343 344 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 342 def checks @checks end |
#equality ⇒ Object (readonly)
341 342 343 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 341 def equality @equality end |
#functions(include_parent = false) ⇒ Hash{String=>PFunction} (readonly)
Returns the functions of this ‘Object` type. If include_parent is `true`, then all inherited functions will be included in the returned `Hash`.
729 730 731 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 729 def functions @functions end |
#name ⇒ Object (readonly)
337 338 339 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 337 def name @name end |
#parent ⇒ Object (readonly)
338 339 340 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 338 def parent @parent end |
Class Method Details
.register_ptype(loader, ir) ⇒ Object
63 64 65 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 63 def self.register_ptype(loader, ir) create_ptype(loader, ir, 'AnyType', 'i12n_hash' => TYPE_OBJECT_I12N) end |
Instance Method Details
#[](name) ⇒ Object
593 594 595 596 597 598 599 600 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 593 def [](name) member = @attributes[name] || @functions[name] if member.nil? rp = resolved_parent member = rp[name] if rp.is_a?(PObjectType) end member end |
#accept(visitor, guard) ⇒ Object
602 603 604 605 606 607 608 609 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 602 def accept(visitor, guard) guarded_recursion(guard, nil) do |g| super(visitor, g) @parent.accept(visitor, g) unless parent.nil? @attributes.values.each { |a| a.accept(visitor, g) } @functions.values.each { |f| f.accept(visitor, g) } end end |
#attr_reader_name(se) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
499 500 501 502 503 504 505 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 499 def attr_reader_name(se) if se.value_type.is_a?(PBooleanType) || se.value_type.is_a?(POptionalType) && se.value_type.type.is_a?(PBooleanType) "#{se.name}?" else se.name end end |
#callable_args?(callable, guard) ⇒ Boolean
611 612 613 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 611 def callable_args?(callable, guard) @parent.nil? ? false : @parent.callable_args?(callable, guard) end |
#check_self_recursion(originator) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Assert that this type does not inherit from itself
736 737 738 739 740 741 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 736 def check_self_recursion(originator) unless @parent.nil? raise Puppet::Error, "The Object type '#{originator.label}' inherits from itself" if @parent.equal?(originator) @parent.check_self_recursion(originator) end end |
#create_i12n_type ⇒ PStructType
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates the type that a initialization hash used for creating instances of this type must conform to.
627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 627 def create_i12n_type struct_elems = {} attributes(true).values.each do |attr| unless attr.kind == ATTRIBUTE_KIND_CONSTANT || attr.kind == ATTRIBUTE_KIND_DERIVED if attr.value? struct_elems[TypeFactory.optional(attr.name)] = attr.type else struct_elems[attr.name] = attr.type end end end TypeFactory.struct(struct_elems) end |
#create_new_function(loader) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 410 def create_new_function(loader) impl_class = implementation_class class_name = impl_class.name || "Anonymous Ruby class for #{name}" (param_names, param_types, required_param_count) = parameter_info # Create the callable with a size that reflects the required and optional parameters param_types << required_param_count param_types << param_names.size create_type = TypeFactory.callable(*param_types) from_hash_type = TypeFactory.callable(i12n_type, 1, 1) # Create and return a #new_XXX function where the dispatchers are added programmatically. Puppet::Functions.create_loaded_function(:"new_#{name}", loader) do # The class that creates new instances must be available to the constructor methods # and is therefore declared as a variable and accessor on the class that represents # this added function. @impl_class = impl_class def self.impl_class @impl_class end # It's recommended that an implementor of an Object type provides the method #from_asserted_hash. # This method should accept a hash and assume that type assertion has been made already (it is made # by the dispatch added here). if impl_class.respond_to?(:from_asserted_hash) dispatcher.add_dispatch(from_hash_type, :from_hash, ['hash'], nil, EMPTY_ARRAY, EMPTY_ARRAY, false) def from_hash(hash) self.class.impl_class.from_asserted_hash(hash) end end # Add the dispatch that uses the standard #new method on the class. It's assumed that the #new # method performs no assertions. dispatcher.add_dispatch(create_type, :create, param_names, nil, EMPTY_ARRAY, EMPTY_ARRAY, false) def create(*args) self.class.impl_class.new(*args) end end end |
#eql?(o) ⇒ Boolean
657 658 659 660 661 662 663 664 665 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 657 def eql?(o) self.class == o.class && @name == o.name && @parent == o.parent && @attributes == o.attributes && @functions == o.functions && @equality == o.equality && @checks == o.checks end |
#equality_attributes ⇒ Hash{String=>PAttribute}
Returns the attributes that participate in equality comparison. Inherited equality attributes are included.
711 712 713 714 715 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 711 def equality_attributes all = {} collect_equality_attributes(all) all end |
#equality_include_type? ⇒ Boolean
Returns ‘true` if this type is included when comparing instances.
719 720 721 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 719 def equality_include_type? @equality_include_type end |
#hash ⇒ Object
667 668 669 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 667 def hash @name.nil? ? [@parent, @attributes, @functions].hash : @name.hash end |
#i12n_hash(include_name = true) ⇒ Hash{String=>Object}
The i12n_hash is primarily intended for serialization and string representation purposes. It creates a hash suitable for passing to PObjectType#new(i12n_hash)
646 647 648 649 650 651 652 653 654 655 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 646 def i12n_hash(include_name = true) result = super() result[KEY_NAME] = @name if include_name && !@name.nil? result[KEY_PARENT] = @parent unless @parent.nil? result[KEY_ATTRIBUTES] = compressed_members_hash(@attributes) unless @attributes.empty? result[KEY_FUNCTIONS] = compressed_members_hash(@functions) unless @functions.empty? result[KEY_EQUALITY] = @equality unless @equality.nil? result[KEY_CHECKS] = @checks unless @checks.nil? result end |
#i12n_type ⇒ PStructType
Returns the type that a initialization hash used for creating instances of this type must conform to.
619 620 621 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 619 def i12n_type @i12n_type ||= create_i12n_type end |
#implementation_class ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 455 def implementation_class if @implementation_class.nil? impl_name = Loaders.implementation_registry.module_name_for_type(self) if impl_name.nil? # Use generator to create a default implementation @implementation_class = RubyGenerator.new.create_class(self) else # Can the mapping be loaded? class_name = impl_name[0] @implementation_class = ClassLoader.provide(class_name) raise Puppet::Error, "Unable to load class #{class_name}" if @implementation_class.nil? unless @implementation_class < PuppetObject || @implementation_class.respond_to?(:ecore) raise Puppet::Error, "Unable to create an instance of #{name}. #{class_name} does not include module #{PuppetObject.name}" end end end @implementation_class end |
#include_class_in_equality? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
508 509 510 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 508 def include_class_in_equality? @equality_include_type && !(@parent.is_a?(PObjectType) && parent.include_class_in_equality?) end |
#initialize_from_hash(i12n_hash) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 513 def initialize_from_hash(i12n_hash) TypeAsserter.assert_instance_of('object initializer', TYPE_OBJECT_I12N, i12n_hash) # Name given to the loader have higher precedence than a name declared in the type @name ||= i12n_hash[KEY_NAME] @name.freeze unless @name.nil? @parent = i12n_hash[KEY_PARENT] parent_members = EMPTY_HASH parent_object_type = nil unless @parent.nil? check_self_recursion(self) rp = resolved_parent if rp.is_a?(PObjectType) parent_object_type = rp parent_members = rp.members(true) end end attr_specs = i12n_hash[KEY_ATTRIBUTES] unless attr_specs.nil? || attr_specs.empty? @attributes = Hash[attr_specs.map do |key, attr_spec| attr_spec = { KEY_TYPE => TypeAsserter.assert_instance_of(nil, PType::DEFAULT, attr_spec) { "attribute #{label}[#{key}]" } } unless attr_spec.is_a?(Hash) attr = PAttribute.new(key, self, attr_spec) [attr.name, attr.assert_override(parent_members)] end].freeze end func_specs = i12n_hash[KEY_FUNCTIONS] unless func_specs.nil? || func_specs.empty? @functions = Hash[func_specs.map do |key, func_spec| func_spec = { KEY_TYPE => TypeAsserter.assert_instance_of(nil, TYPE_FUNCTION_TYPE, func_spec) { "function #{label}[#{key}]" } } unless func_spec.is_a?(Hash) func = PFunction.new(key, self, func_spec) name = func.name raise Puppet::ParseError, "#{func.label} conflicts with attribute with the same name" if @attributes.include?(name) [name, func.assert_override(parent_members)] end].freeze end @equality_include_type = i12n_hash[KEY_EQUALITY_INCLUDE_TYPE] @equality_include_type = true if @equality_include_type.nil? equality = i12n_hash[KEY_EQUALITY] equality = [equality] if equality.is_a?(String) if equality.is_a?(Array) unless equality.empty? raise Puppet::ParseError, 'equality_include_type = false cannot be combined with non empty equality specification' unless @equality_include_type parent_eq_attrs = nil equality.each do |attr_name| attr = parent_members[attr_name] if attr.nil? attr = @attributes[attr_name] || @functions[attr_name] elsif attr.is_a?(PAttribute) # Assert that attribute is not already include by parent equality parent_eq_attrs ||= parent_object_type.equality_attributes if parent_eq_attrs.include?(attr_name) including_parent = find_equality_definer_of(attr) raise Puppet::ParseError, "#{label} equality is referencing #{attr.label} which is included in equality of #{including_parent.label}" end end unless attr.is_a?(PAttribute) raise Puppet::ParseError, "#{label} equality is referencing non existent attribute '#{attr_name}'" if attr.nil? raise Puppet::ParseError, "#{label} equality is referencing #{attr.label}. Only attribute references are allowed" end if attr.kind == ATTRIBUTE_KIND_CONSTANT raise Puppet::ParseError, "#{label} equality is referencing constant #{attr.label}. Reference to constant is not allowed in equality" end end end equality.freeze end @equality = equality @checks = i12n_hash[KEY_CHECKS] init_annotatable(i12n_hash) end |
#instance?(o, guard = nil) ⇒ Boolean
675 676 677 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 675 def instance?(o, guard = nil) assignable?(TypeCalculator.infer(o), guard) end |
#iterable?(guard = nil) ⇒ Boolean
679 680 681 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 679 def iterable?(guard = nil) @parent.nil? ? false : @parent.iterable?(guard) end |
#iterable_type(guard = nil) ⇒ Object
683 684 685 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 683 def iterable_type(guard = nil) @parent.nil? ? false : @parent.iterable_type(guard) end |
#kind_of_callable?(optional = true, guard = nil) ⇒ Boolean
671 672 673 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 671 def kind_of_callable?(optional=true, guard = nil) @parent.nil? ? false : @parent.kind_of_callable?(optional, guard) end |
#label ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
744 745 746 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 744 def label @name || '<anonymous object type>' end |
#members(include_parent = false) ⇒ Hash{String=>PAnnotatedMember}
Returns the members (attributes and functions) of this ‘Object` type. If include_parent is `true`, then all inherited members will be included in the returned `Hash`.
693 694 695 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 693 def members(include_parent = false) get_members(include_parent, :both) end |
#new_function(loader) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
374 375 376 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 374 def new_function(loader) @new_function ||= create_new_function(loader) end |
#parameter_info(attr_readers = false) ⇒ (Array<String>, Array<PAnyType>, Integer)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns array of parameter names, array of parameter types, and a count reflecting the required number of parameters.
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 477 def parameter_info(attr_readers = false) # Create a types and a names array where optional entries ends up last opt_types = [] opt_names = [] non_opt_types = [] non_opt_names = [] i12n_type.elements.each do |se| if se.key_type.is_a?(POptionalType) opt_names << (attr_readers ? attr_reader_name(se) : se.name) opt_types << se.value_type else non_opt_names << (attr_readers ? attr_reader_name(se) : se.name) non_opt_types << se.value_type end end param_names = non_opt_names + opt_names param_types = non_opt_types + opt_types [param_names, param_types, non_opt_types.size] end |
#read(value_count, deserializer) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Read an instance of this type from a deserializer
397 398 399 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 397 def read(value_count, deserializer) reader.read(implementation_class, value_count, deserializer) end |
#reader=(reader) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Assign a new instance reader to this type
381 382 383 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 381 def reader=(reader) @reader = reader end |
#resolved_parent ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
749 750 751 752 753 754 755 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 749 def resolved_parent parent = @parent while parent.is_a?(PTypeAliasType) parent = parent.resolved_type end parent end |
#write(value, serializer) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Write an instance of this type using a serializer
405 406 407 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 405 def write(value, serializer) writer.write(self, value, serializer) end |
#writer=(writer) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Assign a new instance write to this type
388 389 390 |
# File 'lib/puppet/pops/types/p_object_type.rb', line 388 def writer=(writer) @writer = writer end |