Class: RDoc::Markup::ListItem (Ruby 2.5.7)
Description: Class : RDoc::Markup::ListItem - Ruby 2.5.7

### Home Classes Methods

### In Files

- rdoc/markup/list_item.rb

### Parent

Object

### Methods

- ::new
- #<<
- #accept
- #empty?
- #length
- #push

### Class/Module Index

Quicksearch

- RDoc
- RDoc::Alias
- RDoc::AnonClass
- RDoc::AnyMethod
- RDoc::Attr
- RDoc::ClassModule
- RDoc::CodeObject
- RDoc::Comment
- RDoc::Constant
- RDoc::Context
- RDoc::Context::Section
- RDoc::CrossReference
- RDoc::ERBIO
- RDoc::ERBPartial
- RDoc::Encoding
- RDoc::Error
- RDoc::Extend
- RDoc::Generator
- RDoc::Generator::Darkfish
- RDoc::Generator::JsonIndex
- RDoc::Generator::Markup
- RDoc::Generator::POT
- RDoc::Generator::POT::MessageExtractor
- RDoc::Generator::POT::PO
- RDoc::Generator::POT::POEntry
- RDoc::Generator::RI
- RDoc::GhostMethod
- RDoc::I18n
- RDoc::I18n::Locale
- RDoc::I18n::Text
- RDoc::Include
- RDoc::Markdown
- RDoc::Markdown::Literals
- RDoc::Markup
- RDoc::Markup::AttrChanger
- RDoc::Markup::AttrSpan
- RDoc::Markup::AttributeManager
- RDoc::Markup::Attributes
- RDoc::Markup::BlankLine
- RDoc::Markup::BlockQuote
- RDoc::Markup::Document
- RDoc::Markup::Formatter
- RDoc::Markup::FormatterTestCase
- RDoc::Markup::HardBreak
- RDoc::Markup::Include
- RDoc::Markup::IndentedParagraph
- RDoc::Markup::List
- RDoc::Markup::ListItem
- RDoc::Markup::Paragraph
- RDoc::Markup::Parser
- RDoc::Markup::Parser::Error
- RDoc::Markup::Parser::ParseError
- RDoc::Markup::PreProcess
- RDoc::Markup::Raw
- RDoc::Markup::Rule
- RDoc::Markup::Special
- RDoc::Markup::TextFormatterTestCase
- RDoc::Markup::ToAnsi
- RDoc::Markup::ToBs
- RDoc::Markup::ToHtml
- RDoc::Markup::ToHtmlCrossref
- RDoc::Markup::ToHtmlSnippet
- RDoc::Markup::ToJoinedParagraph
- RDoc::Markup::ToLabel
- RDoc::Markup::ToMarkdown
- RDoc::Markup::ToRdoc
- RDoc::Markup::ToTableOfContents
- RDoc::Markup::ToTest
- RDoc::Markup::ToTtOnly
- RDoc::Markup::Verbatim
- RDoc::MetaMethod
- RDoc::MethodAttr
- RDoc::Mixin
- RDoc::NormalClass
- RDoc::NormalModule
- RDoc::Options
- RDoc::Parser
- RDoc::Parser::C
- RDoc::Parser::ChangeLog
- RDoc::Parser::Markdown
- RDoc::Parser::RD
- RDoc::Parser::Ruby
- RDoc::Parser::RubyTools
- RDoc::Parser::Simple
- RDoc::Parser::Text
- RDoc::RD
- RDoc::RD::BlockParser
- RDoc::RD::Inline
- RDoc::RD::InlineParser
- RDoc::RDoc
- RDoc::RI
- RDoc::RI::Driver
- RDoc::RI::Driver::Error
- RDoc::RI::Driver::NotFoundError
- RDoc::RI::Error
- RDoc::RI::Paths
- RDoc::RI::Task
- RDoc::Require
- RDoc::RipperStateLex
- RDoc::RipperStateLex::InnerStateLex
- RDoc::RubygemsHook
- RDoc::Servlet
- RDoc::SingleClass
- RDoc::Stats
- RDoc::Stats::Normal
- RDoc::Stats::Quiet
- RDoc::Stats::Verbose
- RDoc::Store
- RDoc::Store::Error
- RDoc::Store::MissingFileError
- RDoc::Task
- RDoc::TestCase
- RDoc::Text
- RDoc::TokenStream
- RDoc::TomDoc
- RDoc::TopLevel
- RDocTask

No matching classes.

# 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

label[RW]

The label for the `ListItem`

parts[R]

Parts of the `ListItem`

### Public Class Methods

new(label = nil, *parts) click to toggle source

Creates a new `ListItem` with an optional `label` containing `parts`

                   # File rdoc/markup/list_item.rb, line 27
    def initialize label = nil, *parts
      @label = label
      @parts = []
      @parts.concat parts
    end

### Public Instance Methods

<<(part) click to toggle source

Appends `part` to the `ListItem`

                   # File rdoc/markup/list_item.rb, line 36
    def << part
      @parts << part
    end

accept(visitor) click to toggle source

Runs this list item and all its `parts` through `visitor`

                   # File rdoc/markup/list_item.rb, line 49
    def accept visitor
      visitor.accept_list_item_start self

      @parts.each do |part|
        part.accept visitor
      end

      visitor.accept_list_item_end self
    end

empty?() click to toggle source

Is the `ListItem` empty?

                   # File rdoc/markup/list_item.rb, line 62
    def empty?
      @parts.empty?
    end

length() click to toggle source

Length of parts in the `ListItem`

                   # File rdoc/markup/list_item.rb, line 69
    def length
      @parts.length
    end

push(*parts) click to toggle source

Adds `parts` to the `ListItem`

                   # File rdoc/markup/list_item.rb, line 95
    def push *parts
      @parts.concat parts
    end