Class: RDoc::Markup::IndentedParagraph
- Defined in:
- lib/rdoc/markup/indented_paragraph.rb
Overview
An Indented Paragraph of text
Instance Attribute Summary collapse
-
#indent ⇒ Object
readonly
The indent in number of spaces.
Attributes inherited from Raw
Instance Method Summary collapse
-
#==(other) ⇒ Object
:nodoc:.
-
#accept(visitor) ⇒ Object
Calls #accept_indented_paragraph on
visitor
. -
#initialize(indent, *parts) ⇒ IndentedParagraph
constructor
Creates a new IndentedParagraph containing
parts
indented withindent
spaces. -
#text(hard_break = nil) ⇒ Object
Joins the raw paragraph text and converts inline HardBreaks to the
hard_break
text followed by the indent.
Methods inherited from Raw
#<<, #merge, #pretty_print, #push
Constructor Details
#initialize(indent, *parts) ⇒ IndentedParagraph
Creates a new IndentedParagraph containing parts
indented with indent
spaces
16 17 18 19 20 |
# File 'lib/rdoc/markup/indented_paragraph.rb', line 16 def initialize indent, *parts @indent = indent super(*parts) end |
Instance Attribute Details
#indent ⇒ Object (readonly)
The indent in number of spaces
10 11 12 |
# File 'lib/rdoc/markup/indented_paragraph.rb', line 10 def indent @indent end |
Instance Method Details
#==(other) ⇒ Object
:nodoc:
22 23 24 |
# File 'lib/rdoc/markup/indented_paragraph.rb', line 22 def == other # :nodoc: super and indent == other.indent end |
#accept(visitor) ⇒ Object
Calls #accept_indented_paragraph on visitor
29 30 31 |
# File 'lib/rdoc/markup/indented_paragraph.rb', line 29 def accept visitor visitor.accept_indented_paragraph self end |
#text(hard_break = nil) ⇒ Object
Joins the raw paragraph text and converts inline HardBreaks to the hard_break
text followed by the indent.
37 38 39 40 41 42 43 44 45 |
# 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 |