Class: RDoc::Markup::ListItem
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Element
|
|
|
Instance Chain:
self,
Element
|
|
| Inherits: |
RDoc::Markup::Element
|
| Defined in: | lib/rdoc/markup/list_item.rb |
Overview
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
Class Method Summary
- .new(label = nil, *parts) ⇒ ListItem constructor
Instance Attribute Summary
-
#empty? ⇒ Boolean
readonly
Is the
ListItemempty? : () -> bool. -
#label
rw
The label for the
ListItem: (Array | String)? -
#parts
readonly
Parts of the
ListItem: Array.
Instance Method Summary
-
#<<(part)
Appends
partto theListItem: (untyped) -> void. -
#accept(visitor)
Runs this list item and all its #parts through
visitor: (untyped) -> void. -
#length
Length of parts in the
ListItem: () -> Integer. -
#push(*parts)
Adds #parts to the
ListItem: (*untyped) -> void. -
#==(other)
Internal use only
: (top) -> bool.
-
#pretty_print(q)
Internal use only
: (PP) -> void.
Element - Inherited
| #accept | : (untyped) -> void. |
| #pretty_print | : (PP) -> void. |
Constructor Details
.new(label = nil, *parts) ⇒ ListItem
Instance Attribute Details
#empty? ⇒ Boolean (readonly)
Is the ListItem empty?
: () -> bool
# File 'lib/rdoc/markup/list_item.rb', line 53
def empty? @parts.empty? end
#label (rw)
The label for the ListItem
: (Array | String)?
# File 'lib/rdoc/markup/list_item.rb', line 16
attr_accessor :label
#parts (readonly)
Parts of the ListItem
: Array
# File 'lib/rdoc/markup/list_item.rb', line 20
attr_reader :parts
Instance Method Details
#<<(part)
Appends part to the ListItem
: (untyped) -> void
# File 'lib/rdoc/markup/list_item.rb', line 31
def <<(part) @parts << part end
#==(other)
: (top) -> bool
#accept(visitor)
Runs this list item and all its #parts through visitor
: (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
#length
Length of parts in the ListItem
: () -> Integer
# File 'lib/rdoc/markup/list_item.rb', line 59
def length @parts.length end
#pretty_print(q)
: (PP) -> void
# File 'lib/rdoc/markup/list_item.rb', line 65
def pretty_print(q) # :nodoc: q.group(2, '[item: ', ']') do case @label when Array, String q.pp(@label) q.text(';') q.breakable end q.seplist(@parts) do |part| q.pp(part) end end end
#push(*parts)
Adds #parts to the ListItem
: (*untyped) -> void