Class: RDoc::Markup::Raw

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/markup/raw.rb

Overview

A section of text that is added to the output document as-is

Direct Known Subclasses

BlockQuote, IndentedParagraph, Paragraph, Verbatim

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*parts) ⇒ Raw

Creates a new Raw containing parts : (*String) -> void



13
14
15
# File 'lib/rdoc/markup/raw.rb', line 13

def initialize(*parts)
  @parts = parts
end

Instance Attribute Details

#partsObject (readonly)

The component parts of the list : Array



9
10
11
# File 'lib/rdoc/markup/raw.rb', line 9

def parts
  @parts
end

Instance Method Details

#<<(text) ⇒ Object

Appends text : (String) -> void



19
20
21
# File 'lib/rdoc/markup/raw.rb', line 19

def <<(text)
  @parts << text
end

#==(other) ⇒ Object

: (top) -> bool



24
25
26
# File 'lib/rdoc/markup/raw.rb', line 24

def ==(other) # :nodoc:
  self.class == other.class && @parts == other.parts
end

#accept(visitor) ⇒ Object

Calls #accept_raw+ on visitor : (untyped) -> void



31
32
33
# File 'lib/rdoc/markup/raw.rb', line 31

def accept(visitor)
  visitor.accept_raw(self)
end

#merge(other) ⇒ Object

Appends other‘s parts : (Raw) -> void



37
38
39
# File 'lib/rdoc/markup/raw.rb', line 37

def merge(other)
  @parts.concat(other.parts)
end

#pretty_print(q) ⇒ Object

: (PP) -> void



43
44
45
46
47
48
49
50
51
# File 'lib/rdoc/markup/raw.rb', line 43

def pretty_print(q) # :nodoc:
  self.class.name =~ /.*::(\w{1,4})/i

  q.group(2, "[#{$1.downcase}: ", ']') do
    q.seplist(@parts) do |part|
      q.pp(part)
    end
  end
end

#push(*texts) ⇒ Object

Appends texts onto this Paragraph : (*String) -> void



55
56
57
# File 'lib/rdoc/markup/raw.rb', line 55

def push(*texts)
  self.parts.concat(texts)
end

#textObject

The raw text : () -> String



61
62
63
# File 'lib/rdoc/markup/raw.rb', line 61

def text
  @parts.join(" ")
end