123456789_123456789_123456789_123456789_123456789_

Class: RDoc::RD::Inline

Relationships & Source Files
Inherits: Object
Defined in: lib/rdoc/rd/inline.rb

Overview

Inline keeps track of markup and labels to create proper links.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(rdoc, reference = rdoc) ⇒ Inline

Creates a new Inline for #rdoc and #reference.

#rdoc may be another Inline or a String. If #reference is not given it will use the text from #rdoc.

[ GitHub ]

  
# File 'lib/rdoc/rd/inline.rb', line 23

def self.new rdoc, reference = rdoc
  if self === rdoc and reference.equal? rdoc then
    rdoc
  else
    super
  end
end

#initialize(rdoc, reference) ⇒ Inline

Initializes the Inline with #rdoc and inline

[ GitHub ]

  
# File 'lib/rdoc/rd/inline.rb', line 34

def initialize rdoc, reference # :not-new:
  @reference = reference.equal?(rdoc) ? reference.dup : reference

  # unpack
  @reference = @reference.reference if self.class === @reference
  @rdoc      = rdoc
end

Instance Attribute Details

#rdoc (readonly) Also known as: #to_s

The markup of this reference in ::RDoc::RDoc format

[ GitHub ]

  
# File 'lib/rdoc/rd/inline.rb', line 15

attr_reader :rdoc

#reference (readonly)

The text of the reference

[ GitHub ]

  
# File 'lib/rdoc/rd/inline.rb', line 10

attr_reader :reference

#to_s (readonly)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rdoc/rd/inline.rb', line 69

alias to_s rdoc # :nodoc:

Instance Method Details

#==(other)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rdoc/rd/inline.rb', line 42

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

#append(more)

Appends more to this inline. more may be a String or another Inline.

[ GitHub ]

  
# File 'lib/rdoc/rd/inline.rb', line 50

def append more
  case more
  when String then
    @reference += more
    @rdoc      += more
  when RDoc::RD::Inline then
    @reference += more.reference
    @rdoc      += more.rdoc
  else
    raise "unknown thingy #{more}"
  end

  self
end

#inspect

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rdoc/rd/inline.rb', line 65

def inspect # :nodoc:
  "(inline: #{self})"
end