Class: Puppet::Pops::Model::Factory Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/pops/model/factory.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Defined Under Namespace

Classes: ArgsToNonCallError

Constant Summary collapse

STATEMENT_CALLS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

{
  'require' => true,
  'realize' => true,
  'include' => true,
  'contain' => true,
  'tag'     => true,

  'debug'   => true,
  'info'    => true,
  'notice'  => true,
  'warning' => true,
  'err'     => true,

  'fail'    => true,
  'import'  => true,  # discontinued, but transform it to make it call error reporting function
  'break'   => true,
  'next'    => true,
  'return'  => true
}
@@build_visitor =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

Shared build_visitor, since there are many instances of Factory being used

API:

  • private

Visitor.new(self, "build")
@@interpolation_visitor =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

API:

  • private

Visitor.new(self, "interpolate")

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(o, *args) ⇒ Factory

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 a factory with a single object, or a class with arguments applied to build of created instance

API:

  • private



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/puppet/pops/model/factory.rb', line 23

def initialize(o, *args)
  @current = if o.instance_of?(Class)
    @@build_visitor.visit_this(self, o.new, args)
  elsif o.is_a?(PopsObject)
    o
  elsif o.instance_of?(Factory)
    o.current
  else
    @@build_visitor.visit_this(self, o, args)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ 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.

Catch all delegation to current

API:

  • private



528
529
530
531
532
533
534
# File 'lib/puppet/pops/model/factory.rb', line 528

def method_missing(meth, *args, &block)
  if current.respond_to?(meth)
    current.send(meth, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#currentObject Also known as: model

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.

API:

  • private



12
13
14
# File 'lib/puppet/pops/model/factory.rb', line 12

def current
  @current
end

Class Method Details

.APPLICATION(name, parameters, body) ⇒ 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.

API:

  • private



826
827
828
# File 'lib/puppet/pops/model/factory.rb', line 826

def self.APPLICATION(name, parameters, body)
  new(Application, name, parameters, body)
end

.ATTR(name, type_expr = nil) ⇒ 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.

API:

  • private



632
# File 'lib/puppet/pops/model/factory.rb', line 632

def self.ATTR(name, type_expr=nil);    new(CreateAttributeExpression, name, type_expr); end

.ATTRIBUTE_OP(name, op, expr) ⇒ 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.

API:

  • private



758
759
760
# File 'lib/puppet/pops/model/factory.rb', line 758

def self.ATTRIBUTE_OP(name, op, expr)
  new(AttributeOperation, name, op, expr)
end

.ATTRIBUTES_OP(expr) ⇒ 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.

API:

  • private



762
763
764
# File 'lib/puppet/pops/model/factory.rb', line 762

def self.ATTRIBUTES_OP(expr)
  new(AttributesOperation, expr)
end

.block(*args) ⇒ 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.

API:

  • private



614
# File 'lib/puppet/pops/model/factory.rb', line 614

def self.block(*args);                 new(BlockExpression, *args);                     end

.block_or_expression(*args) ⇒ 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.

Builds a BlockExpression if args size > 1, else the single expression/value in args

API:

  • private



806
807
808
809
810
811
812
# File 'lib/puppet/pops/model/factory.rb', line 806

def self.block_or_expression(*args)
  if args.size > 1
    new(BlockExpression, *args)
  else
    new(args[0])
  end
end

.CALL_METHOD(functor, argument_list) ⇒ 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.

API:

  • private



773
774
775
# File 'lib/puppet/pops/model/factory.rb', line 773

def self.CALL_METHOD(functor, argument_list)
  new(CallMethodExpression, functor, true, nil, *argument_list)
end

.CALL_NAMED(name, rval_required, argument_list) ⇒ 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.

API:

  • private



766
767
768
769
770
771
# File 'lib/puppet/pops/model/factory.rb', line 766

def self.CALL_NAMED(name, rval_required, argument_list)
  unless name.kind_of?(PopsObject)
    name = Factory.fqn(name) unless name.instance_of?(Factory)
  end
  new(CallNamedFunctionExpression, name, rval_required, *argument_list)
end

.CAPABILITY_MAPPING(kind, component, cap_name, mappings) ⇒ 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.

API:

  • private



822
823
824
# File 'lib/puppet/pops/model/factory.rb', line 822

def self.CAPABILITY_MAPPING(kind, component, cap_name, mappings)
  new(CapabilityMapping, kind, component, cap_name, mappings)
end

.CASE(test_e, *options) ⇒ 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.

API:

  • private



624
# File 'lib/puppet/pops/model/factory.rb', line 624

def self.CASE(test_e,*options);        new(CaseExpression, test_e, *options);           end

.COLLECT(type_expr, query_expr, attribute_operations) ⇒ 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.

API:

  • private



777
778
779
# File 'lib/puppet/pops/model/factory.rb', line 777

def self.COLLECT(type_expr, query_expr, attribute_operations)
  new(CollectExpression, type_expr, query_expr, attribute_operations)
end

.concat(*args) ⇒ 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.

API:

  • private



1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
# File 'lib/puppet/pops/model/factory.rb', line 1132

def self.concat(*args)
  new(args.map do |e|
    e = e.current if e.is_a?(self)
    case e
    when LiteralString
      e.value
    when String
      e
    else
      raise ArgumentError, "can only concatenate strings, got #{e.class}"
    end
  end.join(''))
end

.DEFINITION(name, parameters, body) ⇒ 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.

API:

  • private



818
819
820
# File 'lib/puppet/pops/model/factory.rb', line 818

def self.DEFINITION(name, parameters, body)
  new(ResourceTypeDefinition, name, parameters, body)
end

.ENUM(*args) ⇒ 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.

API:

  • private



634
# File 'lib/puppet/pops/model/factory.rb', line 634

def self.ENUM(*args);                  new(CreateEnumExpression, *args);                end

.EPP(parameters, body) ⇒ 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.

API:

  • private



695
696
697
698
699
700
701
702
703
704
# File 'lib/puppet/pops/model/factory.rb', line 695

def self.EPP(parameters, body)
  if parameters.nil?
    params = []
    parameters_specified = false
  else
    params = parameters
    parameters_specified = true
  end
  LAMBDA(params, new(EppExpression, parameters_specified, body), nil)
end

.EXPORTED_QUERY(query_expr) ⇒ 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.

API:

  • private



754
755
756
# File 'lib/puppet/pops/model/factory.rb', line 754

def self.EXPORTED_QUERY(query_expr)
  new(ExportedQuery, query_expr)
end

.fqn(o) ⇒ 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.

Creates a QualifiedName representation of o, unless o already represents a QualifiedName in which case it is returned.

API:

  • private



667
668
669
670
671
# File 'lib/puppet/pops/model/factory.rb', line 667

def self.fqn(o)
  o = o.current if o.instance_of?(Factory)
  o = new(QualifiedName, o) unless o.is_a? QualifiedName
  o
end

.fqr(o) ⇒ 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.

Creates a QualifiedName representation of o, unless o already represents a QualifiedName in which case it is returned.

API:

  • private



676
677
678
679
680
# File 'lib/puppet/pops/model/factory.rb', line 676

def self.fqr(o)
  o = o.current if o.instance_of?(Factory)
  o = new(QualifiedReference, o) unless o.is_a? QualifiedReference
  o
end

.FUNCTION(name, parameters, body, return_type) ⇒ 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.

API:

  • private



830
831
832
# File 'lib/puppet/pops/model/factory.rb', line 830

def self.FUNCTION(name, parameters, body, return_type)
  new(FunctionDefinition, name, parameters, body, return_type)
end

.HASH(entries) ⇒ 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.

API:

  • private



638
# File 'lib/puppet/pops/model/factory.rb', line 638

def self.HASH(entries);                new(LiteralHash, *entries);                      end

.HEREDOC(name, expr) ⇒ 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.

API:

  • private



640
# File 'lib/puppet/pops/model/factory.rb', line 640

def self.HEREDOC(name, expr);          new(HeredocExpression, name, expr);              end

.HOSTCLASS(name, parameters, parent, body) ⇒ 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.

API:

  • private



814
815
816
# File 'lib/puppet/pops/model/factory.rb', line 814

def self.HOSTCLASS(name, parameters, parent, body)
  new(HostClassDefinition, name, parameters, parent, body)
end

.IF(test_e, then_e, else_e) ⇒ 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.

API:

  • private



620
# File 'lib/puppet/pops/model/factory.rb', line 620

def self.IF(test_e,then_e,else_e);     new(IfExpression, test_e, then_e, else_e);       end

.KEY_ENTRY(key, val) ⇒ 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.

API:

  • private



636
# File 'lib/puppet/pops/model/factory.rb', line 636

def self.KEY_ENTRY(key, val);          new(KeyedEntry, key, val);                       end

.LAMBDA(parameters, body, return_type) ⇒ 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.

API:

  • private



834
835
836
# File 'lib/puppet/pops/model/factory.rb', line 834

def self.LAMBDA(parameters, body, return_type)
  new(LambdaExpression, parameters, body, return_type)
end

.LIST(entries) ⇒ 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.

API:

  • private



644
# File 'lib/puppet/pops/model/factory.rb', line 644

def self.LIST(entries);                new(LiteralList, *entries);                      end

.literal(o) ⇒ 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.

Factory starting points

API:

  • private



606
# File 'lib/puppet/pops/model/factory.rb', line 606

def self.literal(o);                   new(o);                                                 end

.MAP(match, value) ⇒ 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.

API:

  • private



628
# File 'lib/puppet/pops/model/factory.rb', line 628

def self.MAP(match, value);            new(SelectorEntry, match, value);                end

.minus(o) ⇒ 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.

API:

  • private



608
# File 'lib/puppet/pops/model/factory.rb', line 608

def self.minus(o);                     new(o).minus;                                           end

.NAMED_ACCESS(type_name, bodies) ⇒ 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.

API:

  • private



781
782
783
# File 'lib/puppet/pops/model/factory.rb', line 781

def self.NAMED_ACCESS(type_name, bodies)
  new(NamedAccessExpression, type_name, bodies)
end

.NODE(hosts, parent, body) ⇒ 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.

API:

  • private



648
# File 'lib/puppet/pops/model/factory.rb', line 648

def self.NODE(hosts, parent, body);    new(NodeDefinition, hosts, parent, body);        end

.nop?(o) ⇒ 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.

Returns:

API:

  • private



850
851
852
# File 'lib/puppet/pops/model/factory.rb', line 850

def self.nop? o
  o.nil? || o.is_a?(Nop)
end

.NUMBER(name_or_numeric) ⇒ 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.

API:

  • private



717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/puppet/pops/model/factory.rb', line 717

def self.NUMBER(name_or_numeric)
  if n_radix = Utils.to_n_with_radix(name_or_numeric)
    val, radix = n_radix
    if val.is_a?(Float)
      new(LiteralFloat, val)
    else
      new(LiteralInteger, val, radix)
    end
  else
    # Bad number should already have been caught by lexer - this should never happen
    raise ArgumentError, "Internal Error, NUMBER token does not contain a valid number, #{name_or_numeric}"
  end
end

.PARAM(name, expr = nil) ⇒ 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.

API:

  • private



646
# File 'lib/puppet/pops/model/factory.rb', line 646

def self.PARAM(name, expr=nil);        new(Parameter, name, expr);                      end

.PROGRAM(body, definitions, locator) ⇒ 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.

API:

  • private



801
802
803
# File 'lib/puppet/pops/model/factory.rb', line 801

def self.PROGRAM(body, definitions, locator)
  new(Program, body, definitions, locator)
end

.QNAME(name) ⇒ 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.

TODO: This is the same a fqn factory method, don’t know if callers to fqn and QNAME can live with the same result or not yet - refactor into one method when decided.

API:

  • private



713
714
715
# File 'lib/puppet/pops/model/factory.rb', line 713

def self.QNAME(name)
  new(QualifiedName, name)
end

.QNAME_OR_NUMBER(name) ⇒ 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.

Convert input string to either a qualified name, a LiteralInteger with radix, or a LiteralFloat

API:

  • private



733
734
735
736
737
738
739
740
741
742
743
744
# File 'lib/puppet/pops/model/factory.rb', line 733

def self.QNAME_OR_NUMBER(name)
  if n_radix = Utils.to_n_with_radix(name)
    val, radix = n_radix
    if val.is_a?(Float)
      new(LiteralFloat, val)
    else
      new(LiteralInteger, val, radix)
    end
  else
    new(QualifiedName, name)
  end
end

.QREF(name) ⇒ 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.

API:

  • private



746
747
748
# File 'lib/puppet/pops/model/factory.rb', line 746

def self.QREF(name)
  new(QualifiedReference, name)
end

.record_position(o, start_locatable, end_locateable) ⇒ 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.

API:

  • private



540
541
542
# File 'lib/puppet/pops/model/factory.rb', line 540

def self.record_position(o, start_locatable, end_locateable)
  new(o).record_position(start_locatable, end_locateable)
end

.RENDER_EXPR(expr) ⇒ 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.

API:

  • private



691
692
693
# File 'lib/puppet/pops/model/factory.rb', line 691

def self.RENDER_EXPR(expr)
  new(RenderExpression, expr)
end

.RENDER_STRING(o) ⇒ 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.

TODO_EPP

API:

  • private



687
688
689
# File 'lib/puppet/pops/model/factory.rb', line 687

def self.RENDER_STRING(o)
  new(RenderStringExpression, o)
end

.RESERVED(name, future = false) ⇒ 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.

API:

  • private



706
707
708
# File 'lib/puppet/pops/model/factory.rb', line 706

def self.RESERVED(name, future=false)
  new(ReservedWord, name, future)
end

.RESOURCE(type_name, bodies) ⇒ 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.

API:

  • private



785
786
787
# File 'lib/puppet/pops/model/factory.rb', line 785

def self.RESOURCE(type_name, bodies)
  new(ResourceExpression, type_name, bodies)
end

.RESOURCE_BODY(resource_title, attribute_operations) ⇒ 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.

API:

  • private



797
798
799
# File 'lib/puppet/pops/model/factory.rb', line 797

def self.RESOURCE_BODY(resource_title, attribute_operations)
  new(ResourceBody, resource_title, attribute_operations)
end

.RESOURCE_DEFAULTS(type_name, attribute_operations) ⇒ 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.

API:

  • private



789
790
791
# File 'lib/puppet/pops/model/factory.rb', line 789

def self.RESOURCE_DEFAULTS(type_name, attribute_operations)
  new(ResourceDefaultsExpression, type_name, attribute_operations)
end

.RESOURCE_OVERRIDE(resource_ref, attribute_operations) ⇒ 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.

API:

  • private



793
794
795
# File 'lib/puppet/pops/model/factory.rb', line 793

def self.RESOURCE_OVERRIDE(resource_ref, attribute_operations)
  new(ResourceOverrideExpression, resource_ref, attribute_operations)
end

.resource_shape(expr) ⇒ 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.

Returns symbolic information about an expected shape of a resource expression given the LHS of a resource expr.

  • ‘name { }` => `:resource`, create a resource of the given type

  • ‘Name { }` => ’:defaults`, set defaults for the referenced type

  • ‘Name[] { }` => `:override`, overrides instances referenced by LHS

  • _any other_ => ‘:error’, all other are considered illegal

API:

  • private



584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
# File 'lib/puppet/pops/model/factory.rb', line 584

def self.resource_shape(expr)
  expr = expr.current if expr.instance_of?(Factory)
  case expr
  when QualifiedName
    :resource
  when QualifiedReference
    :defaults
  when AccessExpression
    # if Resource[e], then it is not resource specific
    if expr.left_expr.is_a?(QualifiedReference) && expr.left_expr.value == 'resource' && expr.keys.size == 1
      :defaults
    else
      :override
    end
  when 'class'
    :class
  else
    :error
  end
end

.set_resource_form(expr, form) ⇒ 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.

Sets the form of the resource expression (:regular (the default), :virtual, or :exported). Produces true if the expression was a resource expression, false otherwise.

API:

  • private



569
570
571
572
573
574
575
# File 'lib/puppet/pops/model/factory.rb', line 569

def self.set_resource_form(expr, form)
  expr = expr.current if expr.instance_of?(Factory)
  # Note: Validation handles illegal combinations
  return false unless expr.is_a?(AbstractResource)
  expr.form = form
  return true
end

.SITE(body) ⇒ 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.

API:

  • private



650
# File 'lib/puppet/pops/model/factory.rb', line 650

def self.SITE(body);                   new(SiteDefinition, body);                       end

.string(*args) ⇒ 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.

API:

  • private



616
# File 'lib/puppet/pops/model/factory.rb', line 616

def self.string(*args);                new(ConcatenatedString, *args);                  end

.SUBLOCATE(token, expr) ⇒ 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.

API:

  • private



642
# File 'lib/puppet/pops/model/factory.rb', line 642

def self.SUBLOCATE(token, expr)        new(SubLocatedExpression, token, expr);          end

.text(o) ⇒ 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.

API:

  • private



618
# File 'lib/puppet/pops/model/factory.rb', line 618

def self.text(o);                      new(o).text;                                            end

.TEXT(expr) ⇒ 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.

API:

  • private



682
683
684
# File 'lib/puppet/pops/model/factory.rb', line 682

def self.TEXT(expr)
  new(TextExpression, new(expr).interpolate)
end

.transform_calls(expressions) ⇒ 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.

Transforms an array of expressions containing literal name expressions to calls if followed by an expression, or expression list.

API:

  • private



891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
# File 'lib/puppet/pops/model/factory.rb', line 891

def self.transform_calls(expressions)
  expressions.reduce([]) do |memo, expr|
    expr = expr.current if expr.instance_of?(Factory)
    name = memo[-1]
    if name.is_a?(QualifiedName) && STATEMENT_CALLS[name.value]
      if expr.is_a?(Array)
        expr = expr.reject {|e| e.is_a?(Parser::LexerSupport::TokenValue) }
      else
        expr = [expr]
      end
      the_call = Factory.CALL_NAMED(name, false, expr)
      # last positioned is last arg if there are several
      record_position(the_call, name, expr.is_a?(Array) ? expr[-1]  : expr)
      memo[-1] = the_call
      if expr.is_a?(CallNamedFunctionExpression)
        # Patch statement function call to expression style
        # This is needed because it is first parsed as a "statement" and the requirement changes as it becomes
        # an argument to the name to call transform above.
        expr.rval_required = true
      end
    elsif expr.is_a?(Array)
      raise ArgsToNonCallError.new(expr, name)
    else
      memo << expr
      if expr.is_a?(CallNamedFunctionExpression)
        # Patch rvalue expression function call to statement style.
        # This is not really required but done to be AST model compliant
        expr.rval_required = false
      end
    end
    memo
  end

end

.transform_resource_wo_title(left, attribute_ops, lbrace_token, rbrace_token) ⇒ 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.

Transforms a left expression followed by an untitled resource (in the form of attribute_operations)

Parameters:

  • the lhs followed what may be a hash

API:

  • private



928
929
930
931
932
933
934
935
936
937
938
939
940
# File 'lib/puppet/pops/model/factory.rb', line 928

def self.transform_resource_wo_title(left, attribute_ops, lbrace_token, rbrace_token)
  # Returning nil means accepting the given as a potential resource expression
  return nil unless attribute_ops.is_a? Array
  return nil unless left.current.is_a?(QualifiedName)
  keyed_entries = attribute_ops.map do |ao|
    return nil if ao.operator == :'+>'
    KEY_ENTRY(ao.attribute_name, ao.value_expr)
  end
  a_hash = HASH(keyed_entries)
  a_hash.record_position(lbrace_token, rbrace_token)
  result = block_or_expression(*transform_calls([left, a_hash]))
  result
end

.TYPE(name, super_name = nil) ⇒ 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.

API:

  • private



630
# File 'lib/puppet/pops/model/factory.rb', line 630

def self.TYPE(name, super_name=nil);   new(CreateTypeExpression, name, super_name);     end

.TYPE_ASSIGNMENT(lhs, rhs) ⇒ 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.

API:

  • private



838
839
840
841
842
843
844
# File 'lib/puppet/pops/model/factory.rb', line 838

def self.TYPE_ASSIGNMENT(lhs, rhs)
  if lhs.current.is_a?(AccessExpression)
    new(TypeMapping, lhs, rhs)
  else
    new(TypeAlias, lhs, rhs)
  end
end

.TYPE_DEFINITION(name, parent, body) ⇒ 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.

API:

  • private



846
847
848
# File 'lib/puppet/pops/model/factory.rb', line 846

def self.TYPE_DEFINITION(name, parent, body)
  new(TypeDefinition, name, parent, body)
end

.unfold(o) ⇒ 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.

API:

  • private



610
# File 'lib/puppet/pops/model/factory.rb', line 610

def self.unfold(o);                    new(o).unfold;                                          end

.UNLESS(test_e, then_e, else_e) ⇒ 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.

API:

  • private



622
# File 'lib/puppet/pops/model/factory.rb', line 622

def self.UNLESS(test_e,then_e,else_e); new(UnlessExpression, test_e, then_e, else_e);   end

.var(o) ⇒ 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.

API:

  • private



612
# File 'lib/puppet/pops/model/factory.rb', line 612

def self.var(o);                       new(o).var;                                             end

.VIRTUAL_QUERY(query_expr) ⇒ 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.

API:

  • private



750
751
752
# File 'lib/puppet/pops/model/factory.rb', line 750

def self.VIRTUAL_QUERY(query_expr)
  new(VirtualQuery, query_expr)
end

.WHEN(values_list, block) ⇒ 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.

API:

  • private



626
# File 'lib/puppet/pops/model/factory.rb', line 626

def self.WHEN(values_list, block);     new(CaseOption, values_list, block);             end

Instance Method Details

#%(r) ⇒ 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.

API:

  • private



464
# File 'lib/puppet/pops/model/factory.rb', line 464

def % r;      f_arithmetic(:%, r);                                      end

#*(r) ⇒ 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.

API:

  • private



462
# File 'lib/puppet/pops/model/factory.rb', line 462

def * r;      f_arithmetic(:*, r);                                      end

#+(r) ⇒ 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.

API:

  • private



456
# File 'lib/puppet/pops/model/factory.rb', line 456

def + r;      f_arithmetic(:+, r);                                      end

#-(r) ⇒ 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.

API:

  • private



458
# File 'lib/puppet/pops/model/factory.rb', line 458

def - r;      f_arithmetic(:-, r);                                      end

#/(r) ⇒ 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.

API:

  • private



460
# File 'lib/puppet/pops/model/factory.rb', line 460

def / r;      f_arithmetic(:/, r);                                      end

#<(r) ⇒ 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.

API:

  • private



470
# File 'lib/puppet/pops/model/factory.rb', line 470

def < r;      f_comparison(:<, r);                                      end

#<<(r) ⇒ 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.

API:

  • private



466
# File 'lib/puppet/pops/model/factory.rb', line 466

def << r;     f_arithmetic(:<<, r);                                     end

#<=(r) ⇒ 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.

API:

  • private



472
# File 'lib/puppet/pops/model/factory.rb', line 472

def <= r;     f_comparison(:<=, r);                                     end

#==(r) ⇒ 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.

API:

  • private



478
# File 'lib/puppet/pops/model/factory.rb', line 478

def == r;     f_comparison(:==, r);                                     end

#=~(r) ⇒ 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.

API:

  • private



482
# File 'lib/puppet/pops/model/factory.rb', line 482

def =~ r;     f_match(:'=~', r);                                        end

#>(r) ⇒ 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.

API:

  • private



474
# File 'lib/puppet/pops/model/factory.rb', line 474

def > r;      f_comparison(:>, r);                                      end

#>=(r) ⇒ 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.

API:

  • private



476
# File 'lib/puppet/pops/model/factory.rb', line 476

def >= r;     f_comparison(:>=, r);                                     end

#>>(r) ⇒ 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.

API:

  • private



468
# File 'lib/puppet/pops/model/factory.rb', line 468

def >> r;     f_arithmetic(:>>, r);                                     end

#[](*r) ⇒ 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.

API:

  • private



452
# File 'lib/puppet/pops/model/factory.rb', line 452

def [](*r);   f_build_vararg(AccessExpression, current, *r);     end

#and(r) ⇒ 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.

API:

  • private



440
# File 'lib/puppet/pops/model/factory.rb', line 440

def and(r)    f_build_binary(AndExpression, current, r);         end

#attributes(*args) ⇒ 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.

API:

  • private



522
523
524
525
# File 'lib/puppet/pops/model/factory.rb', line 522

def attributes(*args)
  args.each {|a| current.addAttributes(build(a)) }
  self
end

#build(o, *args) ⇒ 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.

Polymorphic build

API:

  • private



36
37
38
# File 'lib/puppet/pops/model/factory.rb', line 36

def build(o, *args)
  @@build_visitor.visit_this(self, o, args)
end

#build_AccessExpression(o, left, *keys) ⇒ 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.

API:

  • private



77
78
79
80
81
# File 'lib/puppet/pops/model/factory.rb', line 77

def build_AccessExpression(o, left, *keys)
  o.left_expr = to_ops(left)
  o.keys = keys.map {|expr| to_ops(expr) }
  o
end

#build_Application(o, n, ps, body) ⇒ 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.

Building of Model classes

API:

  • private



47
48
49
50
51
52
53
# File 'lib/puppet/pops/model/factory.rb', line 47

def build_Application(o, n, ps, body)
  o.name = n
  ps.each { |p| o.addParameters(build(p)) }
  b = f_build_body(body)
  o.body = b.current if b
  o
end

#build_ArithmeticExpression(o, op, a, b) ⇒ 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.

API:

  • private



55
56
57
58
# File 'lib/puppet/pops/model/factory.rb', line 55

def build_ArithmeticExpression(o, op, a, b)
  o.operator = op
  build_BinaryExpression(o, a, b)
end

#build_Array(o) ⇒ 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.

Creates a LiteralList instruction from an Array, where the entries are built.

API:

  • private



1015
1016
1017
1018
1019
# File 'lib/puppet/pops/model/factory.rb', line 1015

def build_Array(o)
  x = LiteralList.new
  o.each { |v| x.addValues(build(v)) }
  x
end

#build_AssignmentExpression(o, op, a, b) ⇒ 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.

API:

  • private



60
61
62
63
# File 'lib/puppet/pops/model/factory.rb', line 60

def build_AssignmentExpression(o, op, a, b)
  o.operator = op
  build_BinaryExpression(o, a, b)
end

#build_AttributeOperation(o, name, op, value) ⇒ 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.

API:

  • private



65
66
67
68
69
70
# File 'lib/puppet/pops/model/factory.rb', line 65

def build_AttributeOperation(o, name, op, value)
  o.operator = op
  o.attribute_name = name.to_s # BOOLEAN is allowed in the grammar
  o.value_expr = build(value)
  o
end

#build_AttributesOperation(o, value) ⇒ 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.

API:

  • private



72
73
74
75
# File 'lib/puppet/pops/model/factory.rb', line 72

def build_AttributesOperation(o, value)
  o.expr = build(value)
  o
end

#build_BinaryExpression(o, left, right) ⇒ 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.

API:

  • private



83
84
85
86
87
# File 'lib/puppet/pops/model/factory.rb', line 83

def build_BinaryExpression(o, left, right)
  o.left_expr = to_ops(left)
  o.right_expr = to_ops(right)
  o
end

#build_BlockExpression(o, *args) ⇒ 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.

API:

  • private



89
90
91
92
# File 'lib/puppet/pops/model/factory.rb', line 89

def build_BlockExpression(o, *args)
  o.statements = args.map {|expr| to_ops(expr) }
  o
end

#build_CallExpression(o, functor, rval_required, *args) ⇒ 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.

Parameters:

  • if the call must produce a value

API:

  • private



1031
1032
1033
1034
1035
1036
# File 'lib/puppet/pops/model/factory.rb', line 1031

def build_CallExpression(o, functor, rval_required, *args)
  o.functor_expr = to_ops(functor)
  o.rval_required = rval_required
  args.each {|x| o.addArguments(to_ops(x)) }
  o
end

#build_CallMethodExpression(o, functor, rval_required, lambda, *args) ⇒ 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.

API:

  • private



1038
1039
1040
1041
1042
# File 'lib/puppet/pops/model/factory.rb', line 1038

def build_CallMethodExpression(o, functor, rval_required, lambda, *args)
  build_CallExpression(o, functor, rval_required, *args)
  o.lambda = lambda
  o
end

#build_CapabilityMapping(o, kind, component, capability, mappings) ⇒ 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.

API:

  • private



256
257
258
259
260
261
262
263
# File 'lib/puppet/pops/model/factory.rb', line 256

def build_CapabilityMapping(o, kind, component, capability, mappings)
  o.kind = kind
  component = component.current if component.instance_of?(Factory)
  o.component = component
  o.capability = capability
  o.mappings = mappings.map { |m| build(m) }
  o
end

#build_CaseExpression(o, test, *args) ⇒ 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.

API:

  • private



1044
1045
1046
1047
1048
# File 'lib/puppet/pops/model/factory.rb', line 1044

def build_CaseExpression(o, test, *args)
  o.test = build(test)
  args.each {|opt| o.addOptions(build(opt)) }
  o
end

#build_CaseOption(o, value_list, then_expr) ⇒ 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.

API:

  • private



1050
1051
1052
1053
1054
1055
1056
# File 'lib/puppet/pops/model/factory.rb', line 1050

def build_CaseOption(o, value_list, then_expr)
  value_list = [value_list] unless value_list.is_a? Array
  value_list.each { |v| o.addValues(build(v)) }
  b = f_build_body(then_expr)
  o.then_expr = to_ops(b) if b
  o
end

#build_Class(o, *args) ⇒ 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.

Build a Class by creating an instance of it, and then calling build on the created instance with the given arguments

API:

  • private



1060
1061
1062
# File 'lib/puppet/pops/model/factory.rb', line 1060

def build_Class(o, *args)
  build(o.new(), *args)
end

#build_CollectExpression(o, type_expr, query_expr, attribute_operations) ⇒ 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.

API:

  • private



94
95
96
97
98
99
# File 'lib/puppet/pops/model/factory.rb', line 94

def build_CollectExpression(o, type_expr, query_expr, attribute_operations)
  o.type_expr = to_ops(type_expr)
  o.query = build(query_expr)
  o.operations = attribute_operations.map {|op| build(op) }
  o
end

#build_ComparisonExpression(o, op, a, b) ⇒ 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.

API:

  • private



101
102
103
104
# File 'lib/puppet/pops/model/factory.rb', line 101

def build_ComparisonExpression(o, op, a, b)
  o.operator = op
  build_BinaryExpression(o, a, b)
end

#build_ConcatenatedString(o, *args) ⇒ 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.

API:

  • private



106
107
108
109
# File 'lib/puppet/pops/model/factory.rb', line 106

def build_ConcatenatedString(o, *args)
  o.segments = args.map {|expr| build(expr) }
  o
end

#build_CreateAttributeExpression(o, name, datatype_expr) ⇒ 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.

API:

  • private



123
124
125
126
127
# File 'lib/puppet/pops/model/factory.rb', line 123

def build_CreateAttributeExpression(o, name, datatype_expr)
  o.name = name
  o.type = to_ops(datatype_expr)
  o
end

#build_CreateEnumExpression(o, *args) ⇒ 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.

API:

  • private



117
118
119
120
121
# File 'lib/puppet/pops/model/factory.rb', line 117

def build_CreateEnumExpression(o, *args)
  o.name = args.slice(0) if args.size == 2
  o.values = build(args.last)
  o
end

#build_CreateTypeExpression(o, name, super_name = nil) ⇒ 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.

API:

  • private



111
112
113
114
115
# File 'lib/puppet/pops/model/factory.rb', line 111

def build_CreateTypeExpression(o, name, super_name = nil)
  o.name = name
  o.super_name = super_name
  o
end

#build_EppExpression(o, parameters_specified, body) ⇒ 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.

API:

  • private



988
989
990
991
992
993
# File 'lib/puppet/pops/model/factory.rb', line 988

def build_EppExpression(o, parameters_specified, body)
  o.parameters_specified = parameters_specified
  b = f_build_body(body)
  o.body = b.current if b
  o
end

#build_Factory(o) ⇒ 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.

If building a factory, simply unwrap the model oject contained in the factory.

API:

  • private



996
997
998
# File 'lib/puppet/pops/model/factory.rb', line 996

def build_Factory(o)
  o.current
end

#build_FalseClass(o) ⇒ 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.

API:

  • private



964
965
966
967
968
# File 'lib/puppet/pops/model/factory.rb', line 964

def build_FalseClass(o)
  x = LiteralBoolean.new
  x.value = o
  x
end

#build_Fixnum(o) ⇒ 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.

API:

  • private



970
971
972
973
974
# File 'lib/puppet/pops/model/factory.rb', line 970

def build_Fixnum(o)
  x = LiteralInteger.new
  x.value = o;
  x
end

#build_Float(o) ⇒ 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.

API:

  • private



976
977
978
979
980
# File 'lib/puppet/pops/model/factory.rb', line 976

def build_Float(o)
  x = LiteralFloat.new
  x.value = o;
  x
end

#build_FunctionDefinition(o, name, parameters, body, return_type) ⇒ 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.

API:

  • private



247
248
249
250
251
252
253
254
# File 'lib/puppet/pops/model/factory.rb', line 247

def build_FunctionDefinition(o, name, parameters, body, return_type)
  o.parameters = parameters.map {|p| build(p) }
  b = f_build_body(body)
  o.body = b.current if b
  o.name = name
  o.return_type = to_ops(return_type) unless return_type.nil?
  o
end

#build_Hash(o) ⇒ 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.

Create a LiteralHash instruction from a hash, where keys and values are built The hash entries are added in sorted order based on key.to_s

API:

  • private



1024
1025
1026
1027
1028
# File 'lib/puppet/pops/model/factory.rb', line 1024

def build_Hash(o)
  x = LiteralHash.new
  (o.sort_by {|k,v| k.to_s}).each {|k,v| x.addEntries(build(KeyedEntry.new, k, v)) }
  x
end

#build_HeredocExpression(o, name, expr) ⇒ 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.

API:

  • private



129
130
131
132
133
# File 'lib/puppet/pops/model/factory.rb', line 129

def build_HeredocExpression(o, name, expr)
  o.syntax = name
  o.text_expr = build(expr)
  o
end

#build_HostClassDefinition(o, name, parameters, parent_class_name, body) ⇒ HostClassDefinition

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 configured from the parameters.

Parameters:

  • a valid classname

  • may be empty

  • a valid classname referencing a parent class, optional.

  • expression that constitute the body

Returns:

  • configured from the parameters

API:

  • private



141
142
143
144
145
# File 'lib/puppet/pops/model/factory.rb', line 141

def build_HostClassDefinition(o, name, parameters, parent_class_name, body)
  build_NamedDefinition(o, name, parameters, body)
  o.parent_class = parent_class_name if parent_class_name
  o
end

#build_IfExpression(o, t, ift, els) ⇒ 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.

API:

  • private



199
200
201
202
203
204
# File 'lib/puppet/pops/model/factory.rb', line 199

def build_IfExpression(o, t, ift, els)
  o.test = build(t)
  o.then_expr = build(ift)
  o.else_expr= build(els)
  o
end

#build_KeyedEntry(o, k, v) ⇒ 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.

API:

  • private



159
160
161
162
163
# File 'lib/puppet/pops/model/factory.rb', line 159

def build_KeyedEntry(o, k, v)
  o.key = to_collection_entry(to_ops(k))
  o.value = to_collection_entry(to_ops(v))
  o
end

#build_LambdaExpression(o, parameters, body, return_type) ⇒ 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.

API:

  • private



231
232
233
234
235
236
237
# File 'lib/puppet/pops/model/factory.rb', line 231

def build_LambdaExpression(o, parameters, body, return_type)
  o.parameters = parameters.map {|p| build(p) }
  b = f_build_body(body)
  o.body = to_ops(b) if b
  o.return_type = to_ops(return_type) unless return_type.nil?
  o
end

#build_LiteralFloat(o, val) ⇒ 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.

API:

  • private



188
189
190
191
# File 'lib/puppet/pops/model/factory.rb', line 188

def build_LiteralFloat(o, val)
  o.value = val
  o
end

#build_LiteralHash(o, *keyed_entries) ⇒ 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.

API:

  • private



165
166
167
168
# File 'lib/puppet/pops/model/factory.rb', line 165

def build_LiteralHash(o, *keyed_entries)
  o.entries = keyed_entries.map {|entry| build(entry) }
  o
end

#build_LiteralInteger(o, val, radix) ⇒ 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.

API:

  • private



193
194
195
196
197
# File 'lib/puppet/pops/model/factory.rb', line 193

def build_LiteralInteger(o, val, radix)
  o.value = val
  o.radix = radix
  o
end

#build_LiteralList(o, *values) ⇒ 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.

API:

  • private



183
184
185
186
# File 'lib/puppet/pops/model/factory.rb', line 183

def build_LiteralList(o, *values)
  o.values = values.map {|v| to_collection_entry(build(v)) }
  o
end

#build_MatchExpression(o, op, a, b) ⇒ 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.

API:

  • private



206
207
208
209
# File 'lib/puppet/pops/model/factory.rb', line 206

def build_MatchExpression(o, op, a, b)
  o.operator = op
  build_BinaryExpression(o, a, b)
end

#build_NamedDefinition(o, name, parameters, body) ⇒ 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.

API:

  • private



239
240
241
242
243
244
245
# File 'lib/puppet/pops/model/factory.rb', line 239

def build_NamedDefinition(o, name, parameters, body)
  o.parameters = parameters.map {|p| build(p) }
  b = f_build_body(body)
  o.body = b.current if b
  o.name = name
  o
end

#build_NilClass(o) ⇒ 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.

API:

  • private



953
954
955
956
# File 'lib/puppet/pops/model/factory.rb', line 953

def build_NilClass(o)
  x = Nop.new
  x
end

#build_NodeDefinition(o, hosts, parent, body) ⇒ 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.

Parameters:

API:

  • private



269
270
271
272
273
274
275
# File 'lib/puppet/pops/model/factory.rb', line 269

def build_NodeDefinition(o, hosts, parent, body)
  o.host_matches = hosts.map {|h| build(h) }
  o.parent = build(parent) if parent # no nop here
  b = f_build_body(body)
  o.body = b.current if b
  o
end

#build_Parameter(o, name, expr) ⇒ 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.

API:

  • private



285
286
287
288
289
# File 'lib/puppet/pops/model/factory.rb', line 285

def build_Parameter(o, name, expr)
  o.name = name
  o.value = build(expr) if expr # don't build a nil/nop
  o
end

#build_Program(o, body, definitions, locator) ⇒ 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.

API:

  • private



386
387
388
389
390
391
392
393
394
395
# File 'lib/puppet/pops/model/factory.rb', line 386

def build_Program(o, body, definitions, locator)
  o.body = to_ops(body)
  # non containment
  o.definitions = definitions
  o.source_ref = locator.file
  o.source_text = locator.string
  o.line_offsets = locator.line_index
  o.locator = locator
  o
end

#build_QualifiedName(o, name) ⇒ 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.

API:

  • private



397
398
399
400
# File 'lib/puppet/pops/model/factory.rb', line 397

def build_QualifiedName(o, name)
  o.value = name.to_s
  o
end

#build_QualifiedReference(o, name) ⇒ 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.

API:

  • private



291
292
293
294
# File 'lib/puppet/pops/model/factory.rb', line 291

def build_QualifiedReference(o, name)
  o.cased_value = name.to_s
  o
end

#build_QueryExpression(o, expr) ⇒ 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.

API:

  • private



354
355
356
357
358
# File 'lib/puppet/pops/model/factory.rb', line 354

def build_QueryExpression(o, expr)
  ops = to_ops(expr)
  o.expr = ops unless Factory.nop? ops
  o
end

#build_Regexp(o) ⇒ 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.

API:

  • private



982
983
984
985
986
# File 'lib/puppet/pops/model/factory.rb', line 982

def build_Regexp(o)
  x = LiteralRegularExpression.new
  x.value = o;
  x
end

#build_RelationshipExpression(o, op, a, b) ⇒ 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.

API:

  • private



296
297
298
299
# File 'lib/puppet/pops/model/factory.rb', line 296

def build_RelationshipExpression(o, op, a, b)
  o.operator = op
  build_BinaryExpression(o, a, b)
end

#build_RenderStringExpression(o, string) ⇒ 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.

API:

  • private



307
308
309
310
# File 'lib/puppet/pops/model/factory.rb', line 307

def build_RenderStringExpression(o, string)
  o.value = string;
  o
end

#build_ReservedWord(o, name, future) ⇒ 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.

API:

  • private



153
154
155
156
157
# File 'lib/puppet/pops/model/factory.rb', line 153

def build_ReservedWord(o, name, future)
  o.word = name
  o.future = future
  o
end

#build_ResourceBody(o, title_expression, attribute_operations) ⇒ 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.

API:

  • private



312
313
314
315
316
# File 'lib/puppet/pops/model/factory.rb', line 312

def build_ResourceBody(o, title_expression, attribute_operations)
  o.title = build(title_expression)
  o.operations = attribute_operations.map {|ao| build(ao) }
  o
end

#build_ResourceDefaultsExpression(o, type_ref, attribute_operations) ⇒ 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.

API:

  • private



318
319
320
321
322
# File 'lib/puppet/pops/model/factory.rb', line 318

def build_ResourceDefaultsExpression(o, type_ref, attribute_operations)
  o.type_ref = build(type_ref)
  o.operations = attribute_operations.map {|ao| build(ao) }
  o
end

#build_ResourceExpression(o, type_name, bodies) ⇒ 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.

API:

  • private



301
302
303
304
305
# File 'lib/puppet/pops/model/factory.rb', line 301

def build_ResourceExpression(o, type_name, bodies)
  o.type_name = build(type_name)
  o.bodies = bodies.map {|b| build(b) }
  o
end

#build_ResourceOverrideExpression(o, resources, attribute_operations) ⇒ 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.

API:

  • private



147
148
149
150
151
# File 'lib/puppet/pops/model/factory.rb', line 147

def build_ResourceOverrideExpression(o, resources, attribute_operations)
  o.resources = build(resources)
  o.operations = attribute_operations.map {|ao| build(ao) }
  o
end

#build_SelectorEntry(o, matching, value) ⇒ 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.

API:

  • private



348
349
350
351
352
# File 'lib/puppet/pops/model/factory.rb', line 348

def build_SelectorEntry(o, matching, value)
  o.matching_expr = build(matching)
  o.value_expr = build(value)
  o
end

#build_SelectorExpression(o, left, *selectors) ⇒ 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.

API:

  • private



324
325
326
327
328
# File 'lib/puppet/pops/model/factory.rb', line 324

def build_SelectorExpression(o, left, *selectors)
  o.left_expr = to_ops(left)
  o.selectors = selectors.map {|s| build(s) }
  o
end

#build_SiteDefinition(o, body) ⇒ 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.

Parameters:

API:

  • private



279
280
281
282
283
# File 'lib/puppet/pops/model/factory.rb', line 279

def build_SiteDefinition(o, body)
  b = f_build_body(body)
  o.body = b.current if b
  o
end

#build_String(o) ⇒ 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.

Building model equivalences of Ruby objects Allows passing regular ruby objects to the factory to produce instructions that when evaluated produce the same thing.

API:

  • private



947
948
949
950
951
# File 'lib/puppet/pops/model/factory.rb', line 947

def build_String(o)
  x = LiteralString.new
  x.value = o;
  x
end

#build_SubLocatedExpression(o, token, expression) ⇒ 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.

Builds a SubLocatedExpression - this wraps the expression in a sublocation configured from the given token A SubLocated holds its own locator that is used for subexpressions holding positions relative to what it describes.

API:

  • private



335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/puppet/pops/model/factory.rb', line 335

def build_SubLocatedExpression(o, token, expression)
  o.expr = build(expression)
  o.offset = token.offset
  o.length =  token.length
  locator = token.locator
  o.locator = locator
  o.leading_line_count = locator.leading_line_count
  o.leading_line_offset = locator.leading_line_offset
  # Index is held in sublocator's parent locator - needed to be able to reconstruct
  o.line_offsets = locator.locator.line_index
  o
end

#build_Symbol(o) ⇒ 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.

Creates a String literal, unless the symbol is one of the special :undef, or :default which instead creates a LiterlUndef, or a LiteralDefault. Supports :undef because nil creates a no-op instruction.

API:

  • private



1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
# File 'lib/puppet/pops/model/factory.rb', line 1003

def build_Symbol(o)
  case o
  when :undef
    LiteralUndef.new
  when :default
    LiteralDefault.new
  else
    build_String(o.to_s)
  end
end

#build_TokenValue(o) ⇒ 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.

API:

  • private



402
403
404
# File 'lib/puppet/pops/model/factory.rb', line 402

def build_TokenValue(o)
  raise "Factory can not deal with a Lexer Token. Got token: #{o}. Probably caused by wrong index in grammar val[n]."
end

#build_TrueClass(o) ⇒ 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.

API:

  • private



958
959
960
961
962
# File 'lib/puppet/pops/model/factory.rb', line 958

def build_TrueClass(o)
  x = LiteralBoolean.new
  x.value = o
  x
end

#build_TypeAlias(o, name, type_expr) ⇒ 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.

API:

  • private



360
361
362
363
364
# File 'lib/puppet/pops/model/factory.rb', line 360

def build_TypeAlias(o, name, type_expr)
  o.type_expr = to_ops(type_expr)
  o.name = to_ops(name).cased_value
  o
end

#build_TypeDefinition(o, name, parent, body) ⇒ 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.

API:

  • private



372
373
374
375
376
377
378
# File 'lib/puppet/pops/model/factory.rb', line 372

def build_TypeDefinition(o, name, parent, body)
  b = f_build_body(body)
  o.body = b.current if b
  o.parent = parent
  o.name = name
  o
end

#build_TypeMapping(o, lhs, rhs) ⇒ 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.

API:

  • private



366
367
368
369
370
# File 'lib/puppet/pops/model/factory.rb', line 366

def build_TypeMapping(o, lhs, rhs)
  o.type_expr = to_ops(lhs)
  o.mapping_expr = to_ops(rhs)
  o
end

#build_UnaryExpression(o, expr) ⇒ 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.

API:

  • private



380
381
382
383
384
# File 'lib/puppet/pops/model/factory.rb', line 380

def build_UnaryExpression(o, expr)
  ops = to_ops(expr)
  o.expr = ops unless Factory.nop? ops
  o
end

#captures_restObject

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.

Mark parameter as capturing the rest of arguments

API:

  • private



655
656
657
# File 'lib/puppet/pops/model/factory.rb', line 655

def captures_rest()
  current.captures_rest = true
end

#default(r) ⇒ 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.

For CaseExpression, setting the default for an already build CaseExpression

API:

  • private



497
498
499
500
# File 'lib/puppet/pops/model/factory.rb', line 497

def default r
  current.addOptions(Factory.WHEN(:default, r).current)
  self
end

#dot(r) ⇒ 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.

API:

  • private



454
# File 'lib/puppet/pops/model/factory.rb', line 454

def dot r;    f_build_binary(NamedAccessExpression, current, r); end

#f_arithmetic(op, r) ⇒ 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.

API:

  • private



423
424
425
# File 'lib/puppet/pops/model/factory.rb', line 423

def f_arithmetic(op, r)
  f_build_binary_op(ArithmeticExpression, op, current, r)
end

#f_build_binary(klazz, left, right) ⇒ 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.

API:

  • private



415
416
417
# File 'lib/puppet/pops/model/factory.rb', line 415

def f_build_binary(klazz, left, right)
  Factory.new(build(klazz, left, right))
end

#f_build_binary_op(klazz, op, left, right) ⇒ 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.

API:

  • private



411
412
413
# File 'lib/puppet/pops/model/factory.rb', line 411

def f_build_binary_op(klazz, op, left, right)
  Factory.new(build(klazz, op, left, right))
end

#f_build_body(nothing) ⇒ Object #f_build_body(array) ⇒ Object #f_build_body(expr) ⇒ Object #f_build_body(obj) ⇒ 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.

Builds body :) from different kinds of input

Overloads:

  • #f_build_body(nothing) ⇒ Object

    Parameters:

    • unchanged, produces nil

  • #f_build_body(array) ⇒ Object

    Parameters:

    • turns into a BlockExpression

  • #f_build_body(expr) ⇒ Object

    Parameters:

    • produces the given expression

  • #f_build_body(obj) ⇒ Object

    Parameters:

    • produces the result of calling #build with body as argument

API:

  • private



220
221
222
223
224
225
226
227
228
229
# File 'lib/puppet/pops/model/factory.rb', line 220

def f_build_body(body)
  case body
  when NilClass
    nil
  when Array
    Factory.new(BlockExpression, *body)
  else
    build(body)
  end
end

#f_build_unary(klazz, expr) ⇒ 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.

Factory helpers

API:

  • private



407
408
409
# File 'lib/puppet/pops/model/factory.rb', line 407

def f_build_unary(klazz, expr)
  Factory.new(build(klazz, expr))
end

#f_build_vararg(klazz, left, *arg) ⇒ 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.

API:

  • private



419
420
421
# File 'lib/puppet/pops/model/factory.rb', line 419

def f_build_vararg(klazz, left, *arg)
  Factory.new(build(klazz, left, *arg))
end

#f_comparison(op, r) ⇒ 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.

API:

  • private



427
428
429
# File 'lib/puppet/pops/model/factory.rb', line 427

def f_comparison(op, r)
  f_build_binary_op(ComparisonExpression, op, current, r)
end

#f_match(op, r) ⇒ 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.

API:

  • private



431
432
433
# File 'lib/puppet/pops/model/factory.rb', line 431

def f_match(op, r)
  f_build_binary_op(MatchExpression, op, current, r)
end

#in(r) ⇒ 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.

Operator helpers

API:

  • private



436
# File 'lib/puppet/pops/model/factory.rb', line 436

def in(r)     f_build_binary(InExpression, current, r);          end

#interpolateObject

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.

Polymorphic interpolate

API:

  • private



41
42
43
# File 'lib/puppet/pops/model/factory.rb', line 41

def interpolate()
  @@interpolation_visitor.visit_this_0(self, current)
end

#interpolate_AccessExpression(o) ⇒ 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.

rewrite left expression to variable if it is name, number, and recurse if it is an access expression this is for interpolation support in new lexer ($NAME, $NAME[}, $NUMBER, $NUMBER[] - all other expressions requires variables to be preceded with $

API:

  • private



1085
1086
1087
1088
1089
1090
# File 'lib/puppet/pops/model/factory.rb', line 1085

def interpolate_AccessExpression(o)
  if is_interop_rewriteable?(o.left_expr)
    o.left_expr = to_ops(self.class.new(o.left_expr).interpolate)
  end
  o
end

#interpolate_CallMethodExpression(o) ⇒ 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.

Rewrite method calls on the form $… to $Puppet::Pops::Model::Factory.$x$x.each

API:

  • private



1100
1101
1102
1103
1104
1105
# File 'lib/puppet/pops/model/factory.rb', line 1100

def interpolate_CallMethodExpression(o)
  if is_interop_rewriteable?(o.functor_expr)
    o.functor_expr = to_ops(self.class.new(o.functor_expr).interpolate)
  end
  o
end

#interpolate_Factory(o) ⇒ 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.

API:

  • private



1064
1065
1066
# File 'lib/puppet/pops/model/factory.rb', line 1064

def interpolate_Factory(o)
  interpolate(o.current)
end

#interpolate_LiteralInteger(o) ⇒ 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.

API:

  • private



1068
1069
1070
1071
# File 'lib/puppet/pops/model/factory.rb', line 1068

def interpolate_LiteralInteger(o)
  # convert number to a variable
  self.class.new(o).var
end

#interpolate_NamedAccessExpression(o) ⇒ 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.

API:

  • private



1092
1093
1094
1095
1096
1097
# File 'lib/puppet/pops/model/factory.rb', line 1092

def interpolate_NamedAccessExpression(o)
  if is_interop_rewriteable?(o.left_expr)
      o.left_expr = to_ops(self.class.new(o.left_expr).interpolate)
  end
  o
end

#interpolate_Object(o) ⇒ 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.

API:

  • private



1073
1074
1075
# File 'lib/puppet/pops/model/factory.rb', line 1073

def interpolate_Object(o)
  o
end

#interpolate_QualifiedName(o) ⇒ 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.

API:

  • private



1077
1078
1079
# File 'lib/puppet/pops/model/factory.rb', line 1077

def interpolate_QualifiedName(o)
  self.class.new(o).var
end

#is_interop_rewriteable?(o) ⇒ 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.

Returns:

API:

  • private



1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
# File 'lib/puppet/pops/model/factory.rb', line 1107

def is_interop_rewriteable?(o)
  case o
  when AccessExpression, QualifiedName,
    NamedAccessExpression, CallMethodExpression
    true
  when LiteralInteger
    # Only decimal integers can represent variables, else it is a number
    o.radix == 10
  else
    false
  end
end

#lambda=(lambda) ⇒ 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.

API:

  • private



502
503
504
505
# File 'lib/puppet/pops/model/factory.rb', line 502

def lambda=(lambda)
  current.lambda = lambda.current
  self
end

#lengthObject

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.

API:

  • private



548
549
550
# File 'lib/puppet/pops/model/factory.rb', line 548

def length
  @current.length
end

#locPuppet::Pops::Adapters::SourcePosAdapter

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 with location information.

Returns:

  • with location information

API:

  • private



562
563
564
# File 'lib/puppet/pops/model/factory.rb', line 562

def loc()
  Adapters::SourcePosAdapter.adapt(current)
end

#minusObject

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.

API:

  • private



444
# File 'lib/puppet/pops/model/factory.rb', line 444

def minus();  f_build_unary(UnaryMinusExpression, self);         end

#minus_set(r) ⇒ 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.

Assignment -=

API:

  • private



518
519
520
# File 'lib/puppet/pops/model/factory.rb', line 518

def minus_set(r)
  f_build_binary_op(AssignmentExpression, :'-=', current, r)
end

#mne(r) ⇒ 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.

API:

  • private



484
# File 'lib/puppet/pops/model/factory.rb', line 484

def mne r;    f_match(:'!~', r);                                        end

#name_is_statement(name) ⇒ 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.

Returns true if the given name is a “statement keyword” (require, include, contain, error, notice, info, debug

API:

  • private



876
877
878
# File 'lib/puppet/pops/model/factory.rb', line 876

def name_is_statement(name)
  STATEMENT_CALLS[name]
end

#ne(r) ⇒ 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.

API:

  • private



480
# File 'lib/puppet/pops/model/factory.rb', line 480

def ne r;     f_comparison(:'!=', r);                                   end

#notObject

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.

API:

  • private



442
# File 'lib/puppet/pops/model/factory.rb', line 442

def not();    f_build_unary(NotExpression, self);                end

#offsetObject

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.

API:

  • private



544
545
546
# File 'lib/puppet/pops/model/factory.rb', line 544

def offset
  @current.offset
end

#or(r) ⇒ 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.

API:

  • private



438
# File 'lib/puppet/pops/model/factory.rb', line 438

def or(r)     f_build_binary(OrExpression, current, r);          end

#parenObject

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.

API:

  • private



486
# File 'lib/puppet/pops/model/factory.rb', line 486

def paren();  f_build_unary(ParenthesizedExpression, current);   end

#plus_set(r) ⇒ 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.

Assignment +=

API:

  • private



513
514
515
# File 'lib/puppet/pops/model/factory.rb', line 513

def plus_set(r)
  f_build_binary_op(AssignmentExpression, :'+=', current, r)
end

#record_position(start_locatable, end_locatable) ⇒ 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.

Records the position (start -> end) and computes the resulting length.

API:

  • private



554
555
556
557
558
559
# File 'lib/puppet/pops/model/factory.rb', line 554

def record_position(start_locatable, end_locatable)
  # record information directly in the Positioned object
  start_offset = start_locatable.offset
  @current.set_loc(start_offset, end_locatable ? end_locatable.offset - start_offset + end_locatable.length : start_locatable.length)
  self
end

#relop(op, r) ⇒ 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.

API:

  • private



488
489
490
# File 'lib/puppet/pops/model/factory.rb', line 488

def relop op, r
  f_build_binary_op(RelationshipExpression, op.to_sym, current, r)
end

#respond_to?(meth, include_all = false) ⇒ 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.

Returns:

API:

  • private



536
537
538
# File 'lib/puppet/pops/model/factory.rb', line 536

def respond_to?(meth, include_all=false)
  current.respond_to?(meth, include_all) || super
end

#select(*args) ⇒ 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.

API:

  • private



492
493
494
# File 'lib/puppet/pops/model/factory.rb', line 492

def select *args
  Factory.new(build(SelectorExpression, current, *args))
end

#set(r) ⇒ 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.

Assignment =

API:

  • private



508
509
510
# File 'lib/puppet/pops/model/factory.rb', line 508

def set(r)
  f_build_binary_op(AssignmentExpression, :'=', current, r)
end

#textObject

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.

API:

  • private



448
# File 'lib/puppet/pops/model/factory.rb', line 448

def text();   f_build_unary(TextExpression, self);               end

#to_collection_entry(o) ⇒ 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.

API:

  • private



170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/puppet/pops/model/factory.rb', line 170

def to_collection_entry(o)
  if o.is_a?(Model::ReservedWord)
    case o.word
    when 'application', 'site', 'produces', 'consumes'
      build(o.word)
    else
      o
    end
  else
    o
  end
end

#to_ops(o, *args) ⇒ 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.

Checks if the object is already a model object, or build it

API:

  • private



1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
# File 'lib/puppet/pops/model/factory.rb', line 1121

def to_ops(o, *args)
  case o
  when PopsObject
    o
  when Factory
    o.current
  else
    build(o, *args)
  end
end

#to_sObject

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.

API:

  • private



1146
1147
1148
# File 'lib/puppet/pops/model/factory.rb', line 1146

def to_s
  ModelTreeDumper.new.dump(self)
end

#type_expr(o) ⇒ 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.

Set Expression that should evaluate to the parameter’s type

API:

  • private



660
661
662
# File 'lib/puppet/pops/model/factory.rb', line 660

def type_expr(o)
  current.type_expr = to_ops(o)
end

#unfoldObject

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.

API:

  • private



446
# File 'lib/puppet/pops/model/factory.rb', line 446

def unfold(); f_build_unary(UnfoldExpression, self);             end

#varObject

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.

API:

  • private



450
# File 'lib/puppet/pops/model/factory.rb', line 450

def var();    f_build_unary(VariableExpression, self);           end