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


15
16
17
18
# File 'lib/rdoc/markup/raw.rb', line 15

def initialize *parts
  @parts = []
  @parts.concat parts
end

Instance Attribute Details

#partsObject (readonly)

The component parts of the list


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

def parts
  @parts
end

Instance Method Details

#<<(text) ⇒ Object

Appends text


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

def << text
  @parts << text
end

#==(other) ⇒ Object

:nodoc:


27
28
29
# File 'lib/rdoc/markup/raw.rb', line 27

def == other # :nodoc:
  self.class == other.class and @parts == other.parts
end

#accept(visitor) ⇒ Object

Calls #accept_raw+ on visitor


34
35
36
# File 'lib/rdoc/markup/raw.rb', line 34

def accept visitor
  visitor.accept_raw self
end

#merge(other) ⇒ Object

Appends other's parts


41
42
43
# File 'lib/rdoc/markup/raw.rb', line 41

def merge other
  @parts.concat other.parts
end

#pretty_print(q) ⇒ Object

:nodoc:


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

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


58
59
60
# File 'lib/rdoc/markup/raw.rb', line 58

def push *texts
  self.parts.concat texts
end

#textObject

The raw text


65
66
67
# File 'lib/rdoc/markup/raw.rb', line 65

def text
  @parts.join ' '
end