| Server IP : 77.68.64.21 / Your IP : 216.73.217.59 Web Server : Apache System : Linux hp3-wp-1011352.hostingp3.local 3.10.0-1160.144.1.el7.tuxcare.els9.x86_64 #1 SMP Fri Jul 10 17:06:31 UTC 2026 x86_64 User : csh2516497 ( 2094697) PHP Version : 8.3.30 Disable Function : shell_exec,exec,system,popen,set_time_limit MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/ruby/vendor_ruby/puppet/parser/ast/ |
Upload File : |
require 'puppet/parser/ast'
require 'puppet/parser/ast/branch'
require 'puppet/parser/relationship'
class Puppet::Parser::AST::Relationship < Puppet::Parser::AST::Branch
RELATIONSHIP_TYPES = %w{-> <- ~> <~}
attr_accessor :left, :right, :arrow, :type
# Evaluate our object, but just return a simple array of the type
# and name.
def evaluate(scope)
real_left = left.safeevaluate(scope)
real_right = right.safeevaluate(scope)
source, target = sides2edge(real_left, real_right)
scope.compiler.add_relationship Puppet::Parser::Relationship.new(source, target, type)
real_right
end
def initialize(left, right, arrow, args = {})
super(args)
unless RELATIONSHIP_TYPES.include?(arrow)
raise ArgumentError, "Invalid relationship type #{arrow.inspect}; valid types are #{RELATIONSHIP_TYPES.collect { |r| r.to_s }.join(", ")}"
end
@left, @right, @arrow = left, right, arrow
end
def type
subscription? ? :subscription : :relationship
end
def sides2edge(left, right)
out_edge? ? [left, right] : [right, left]
end
private
def out_edge?
["->", "~>"].include?(arrow)
end
def subscription?
["~>", "<~"].include?(arrow)
end
end