123456789_123456789_123456789_123456789_123456789_

Class: RDoc::Markup::IndentedParagraph

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Raw
Instance Chain:
self, Raw
Inherits: RDoc::Markup::Raw
Defined in: lib/rdoc/markup/indented_paragraph.rb

Overview

An Indented Paragraph of text

Class Method Summary

Raw - Inherited

.new

Creates a new Raw containing parts

Instance Attribute Summary

  • #indent readonly

    The indent in number of spaces.

Raw - Inherited

#parts

The component parts of the list.

Instance Method Summary

Raw - Inherited

#<<

Appends #text

#accept

Calls #accept_raw+ on visitor

#merge

Appends other's parts.

#push

Appends texts onto this Paragraph.

#text

The raw text.

#==, #pretty_print

Constructor Details

.new(indent, *parts) ⇒ IndentedParagraph

Creates a new IndentedParagraph containing parts indented with #indent spaces

[ GitHub ]

  
# File 'lib/rdoc/markup/indented_paragraph.rb', line 16

def initialize indent, *parts
  @indent = indent

  super(*parts)
end

Instance Attribute Details

#indent (readonly)

The indent in number of spaces

[ GitHub ]

  
# File 'lib/rdoc/markup/indented_paragraph.rb', line 10

attr_reader :indent

Instance Method Details

#==(other)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rdoc/markup/indented_paragraph.rb', line 22

def == other # :nodoc:
  super and indent == other.indent
end

#accept(visitor)

Calls #accept_indented_paragraph on visitor

[ GitHub ]

  
# File 'lib/rdoc/markup/indented_paragraph.rb', line 29

def accept visitor
  visitor.accept_indented_paragraph self
end

#text(hard_break = nil)

Joins the raw paragraph text and converts inline HardBreaks to the hard_break text followed by the indent.

[ GitHub ]

  
# File 'lib/rdoc/markup/indented_paragraph.rb', line 37

def text hard_break = nil
  @parts.map do |part|
    if RDoc::Markup::HardBreak === part then
      '%1$s%3$*2$s' % [hard_break, @indent, ' '] if hard_break
    else
      part
    end
  end.join
end