Class: Puppet::Pops::PN::Call
Constant Summary
KEY_PATTERN
Instance Attribute Summary collapse
Instance Method Summary
collapse
#==, #double_quote, #format_elements, #pnError, #to_s, #with_name
Constructor Details
#initialize(name, *elements) ⇒ Call
Returns a new instance of Call.
88
89
90
91
|
# File 'lib/puppet/pops/pn.rb', line 88
def initialize(name, *elements)
@name = name
@elements = elements
end
|
Instance Attribute Details
86
87
88
|
# File 'lib/puppet/pops/pn.rb', line 86
def elements
@elements
end
|
86
87
88
|
# File 'lib/puppet/pops/pn.rb', line 86
def name
@name
end
|
Instance Method Details
93
94
95
|
# File 'lib/puppet/pops/pn.rb', line 93
def [](idx)
@elements[idx]
end
|
#as_call(name) ⇒ Object
97
98
99
|
# File 'lib/puppet/pops/pn.rb', line 97
def as_call(name)
Call.new(name, *@elements)
end
|
#as_parameters ⇒ Object
101
102
103
|
# File 'lib/puppet/pops/pn.rb', line 101
def as_parameters
List.new(@elements)
end
|
#eql?(o) ⇒ Boolean
105
106
107
|
# File 'lib/puppet/pops/pn.rb', line 105
def eql?(o)
o.is_a?(Call) && @name == o.name && @elements == o.elements
end
|
109
110
111
112
113
114
115
116
|
# File 'lib/puppet/pops/pn.rb', line 109
def format(indent, b)
b << '(' << @name
if @elements.size > 0
b << ' ' unless indent
format_elements(@elements, indent ? indent.increase : nil, b)
end
b << ')'
end
|
118
119
120
|
# File 'lib/puppet/pops/pn.rb', line 118
def to_data
{ '^' => [@name] + @elements.map(&:to_data) }
end
|