Class: Maven::Model::ListItems
Instance Method Summary collapse
- #add(item) ⇒ Object (also: #<<)
-
#initialize(name = nil) ⇒ ListItems
constructor
A new instance of ListItems.
- #to_xml(buf = "", indent = "") ⇒ Object
Methods inherited from Tag
#_name, _tags, #comment, prepend_tags, tags
Constructor Details
#initialize(name = nil) ⇒ ListItems
Returns a new instance of ListItems.
304 305 306 |
# File 'lib/maven/model/utils.rb', line 304 def initialize(name = nil) @name = name end |
Instance Method Details
#add(item) ⇒ Object Also known as: <<
308 309 310 311 |
# File 'lib/maven/model/utils.rb', line 308 def add(item) @items ||= Array.new @items << item end |
#to_xml(buf = "", indent = "") ⇒ Object
314 315 316 317 318 319 320 321 |
# File 'lib/maven/model/utils.rb', line 314 def to_xml(buf = "", indent = "") buf << "#{indent}<#{@name}>\n" if @name buf << "#{indent}<!--\n#{indent}#{@comment}\n#{indent}-->\n" if @comment @items.each do |i| i.to_xml(buf, indent) end buf << "#{indent}</#{@name}>\n" if @name end |