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


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

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

Instance Attribute Details

#partsObject (readonly)

The component parts of the list


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

def parts
  @parts
end

Instance Method Details

#<<(text) ⇒ Object

Appends text


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

def << text
  @parts << text
end

#==(other) ⇒ Object

:nodoc:


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

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

#accept(visitor) ⇒ Object

Calls #accept_raw+ on visitor


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

def accept visitor
  visitor.accept_raw self
end

#merge(other) ⇒ Object

Appends other's parts


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

def merge other
  @parts.concat other.parts
end

#pretty_print(q) ⇒ Object

:nodoc:


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

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


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

def push *texts
  self.parts.concat texts
end

#textObject

The raw text


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

def text
  @parts.join ' '
end