Class: RDoc::Markup::List (Ruby 2.7.3)
Description: Class : RDoc::Markup::List - Ruby 2.7.3

### Home Classes Methods

### In Files

- rdoc/markup/list.rb

### Parent

Object

### Methods

- ::new
- #<<
- #accept
- #empty?
- #last
- #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::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::MyStringScanner
- RDoc::Markup::Parser::ParseError
- RDoc::Markup::PreProcess
- RDoc::Markup::Raw
- RDoc::Markup::RegexpHandling
- RDoc::Markup::Rule
- 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::RipperStateLex
- RDoc::Parser::RipperStateLex::InnerStateLex
- 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::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::Text
- RDoc::TokenStream
- RDoc::TomDoc
- RDoc::TopLevel
- RDocTask

No matching classes.

# RDoc::Markup::List

A `List` is a homogeneous set of ListItems.

The supported list types include:

:BULLET

  An unordered list

:LABEL

  An unordered definition list, but using an alternate `RDoc::Markup` syntax

:LALPHA

  An ordered list using increasing lowercase English letters

:NOTE

  An unordered definition list

:NUMBER

  An ordered list using increasing Arabic numerals

:UALPHA

  An ordered list using increasing uppercase English letters

Definition lists behave like HTML definition lists. Each list item can describe multiple terms. See `RDoc::Markup::ListItem` for how labels and definition are stored as list items.

### Attributes

items[R]

Items in the list

type[RW]

The list's type

### Public Class Methods

new(type = nil, *items) click to toggle source

Creates a new list of `type` with `items`. Valid list types are: `:BULLET`, `:LABEL`, `:LALPHA`, `:NOTE`, `:NUMBER`, `:UALPHA`

                   # File rdoc/markup/list.rb, line 40
    def initialize type = nil, *items
      @type = type
      @items = []
      @items.concat items
    end

### Public Instance Methods

<<(item) click to toggle source

Appends `item` to the list

                   # File rdoc/markup/list.rb, line 49
    def << item
      @items << item
    end

accept(visitor) click to toggle source

Runs this list and all its `items` through `visitor`

                   # File rdoc/markup/list.rb, line 62
    def accept visitor
      visitor.accept_list_start self

      @items.each do |item|
        item.accept visitor
      end

      visitor.accept_list_end self
    end

empty?() click to toggle source

Is the list empty?

                   # File rdoc/markup/list.rb, line 75
    def empty?
      @items.empty?
    end

last() click to toggle source

Returns the last item in the list

                   # File rdoc/markup/list.rb, line 82
    def last
      @items.last
    end

push(*items) click to toggle source

Appends `items` to the list

                   # File rdoc/markup/list.rb, line 97
    def push *items
      @items.concat items
    end