Class: Puppet::Pops::PN::List
Constant Summary
KEY_PATTERN
Instance Attribute Summary collapse
Instance Method Summary
collapse
#==, #double_quote, #format_elements, #pnError, #to_s, #with_name
Constructor Details
#initialize(elements) ⇒ List
Returns a new instance of List.
142
143
144
|
# File 'lib/puppet/pops/pn.rb', line 142
def initialize(elements)
@elements = elements
end
|
Instance Attribute Details
140
141
142
|
# File 'lib/puppet/pops/pn.rb', line 140
def elements
@elements
end
|
Instance Method Details
146
147
148
|
# File 'lib/puppet/pops/pn.rb', line 146
def [](idx)
@elements[idx]
end
|
#as_call(name) ⇒ Object
150
151
152
|
# File 'lib/puppet/pops/pn.rb', line 150
def as_call(name)
Call.new(name, *@elements)
end
|
#as_parameters ⇒ Object
154
155
156
|
# File 'lib/puppet/pops/pn.rb', line 154
def as_parameters
@elements
end
|
#eql?(o) ⇒ Boolean
158
159
160
|
# File 'lib/puppet/pops/pn.rb', line 158
def eql?(o)
o.is_a?(List) && @elements == o.elements
end
|
162
163
164
165
166
|
# File 'lib/puppet/pops/pn.rb', line 162
def format(indent, b)
b << '['
format_elements(@elements, indent ? indent.increase : nil, b) unless @elements.empty?
b << ']'
end
|
168
169
170
|
# File 'lib/puppet/pops/pn.rb', line 168
def to_data
@elements.map(&:to_data)
end
|