Sha256: 38eb219b06340d1699b297dfbc29c20f405e9ab8e5116349824d4a6064cfa3f0

Contents?: true

Size: 922 Bytes

Versions: 5

Compression:

Stored size: 922 Bytes

Contents

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

class RDoc::Markup::Raw

  ##
  # The component parts of the list

  attr_reader :parts

  ##
  # Creates a new Raw containing +parts+

  def initialize *parts
    @parts = []
    @parts.push(*parts)
  end

  ##
  # Appends +text+

  def << text
    @parts << text
  end

  def == other # :nodoc:
    self.class == other.class and text == other.text
  end

  def accept visitor
    visitor.accept_raw self
  end

  ##
  # Appends +other+'s parts

  def merge other
    @parts.push(*other.parts)
  end

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

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

  ##
  # Appends +texts+ onto this Paragraph

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

  ##
  # The raw text

  def text
    @parts.join ' '
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rdoc-2.5.11 lib/rdoc/markup/raw.rb
rdoc-2.5.10 lib/rdoc/markup/raw.rb
rdoc-2.5.9 lib/rdoc/markup/raw.rb
rdoc-2.5.8 lib/rdoc/markup/raw.rb
rdoc-2.5.7 lib/rdoc/markup/raw.rb