class RDoc::Markup::ListItem
An item within a List that contains paragraphs, headings, etc.
For BULLET, NUMBER, LALPHA and UALPHA lists, the label will always be nil. For NOTE and LABEL lists, the list label may contain:
-
a single String for a single label
-
an Array of Strings for a list item with multiple terms
-
nil for an extra description attached to a previously labeled list item
Attributes
The label for the ListItem
: (Array | String)?
Public Class Methods
Creates a new ListItem with an optional +label+ containing +parts+
: ((Array | String)?, *untyped) -> void
# File lib/rdoc/markup/list_item.rb, line 24 def initialize(label = nil, *parts) @label = label @parts = parts end
Public Instance Methods
Appends +part+ to the ListItem
: (untyped) -> void
# File lib/rdoc/markup/list_item.rb, line 31 def <<(part) @parts << part end
Runs this list item and all its #parts through +visitor+ @override
: (untyped) -> void
# File lib/rdoc/markup/list_item.rb, line 45 def accept(visitor) visitor.accept_list_item_start(self) @parts.each { |part| part.accept(visitor) } visitor.accept_list_item_end(self) end
Is the ListItem empty?
: () -> bool
# File lib/rdoc/markup/list_item.rb, line 53 def empty? @parts.empty? end
Length of parts in the ListItem
: () -> Integer
# File lib/rdoc/markup/list_item.rb, line 59 def length @parts.length end
Adds +parts+ to the ListItem
: (*untyped) -> void
# File lib/rdoc/markup/list_item.rb, line 82 def push(*parts) @parts.concat(parts) end