Class: RDoc::Markup::ListItem

### Home Classes Methods

### In Files

- lib/rdoc/markup/list_item.rb

### Parent

Object

### Methods

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

### Files

- CONTRIBUTING.rdoc
- CVE-2013-0256.rdoc
- ExampleRDoc.rdoc
- LICENSE.rdoc
- Manifest.txt
- README.rdoc
- RI.rdoc
- Rakefile
- TODO.rdoc

### 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::Gauntlet
- RDoc::Generator
- RDoc::Generator::Darkfish
- RDoc::Generator::JsonIndex
- RDoc::Generator::Markup
- RDoc::Generator::POT
- RDoc::Generator::RI
- RDoc::GhostMethod
- 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::Require
- RDoc::RubyLex
- RDoc::RubyLex::Error
- RDoc::RubyToken
- 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::Task
- RDoc::TestCase
- RDoc::TokenStream
- RDoc::TomDoc
- RDoc::TopLevel
- Object

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 lib/rdoc/markup/list_item.rb, line 26
    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 lib/rdoc/markup/list_item.rb, line 35
    def << part
      @parts << part
    end

accept(visitor) click to toggle source

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

    # File lib/rdoc/markup/list_item.rb, line 48
    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 lib/rdoc/markup/list_item.rb, line 61
    def empty?
      @parts.empty?
    end

length() click to toggle source

Length of parts in the ListItem

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

push(*parts) click to toggle source

Adds `parts` to the ListItem

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.