Class: RDoc::RD::Inline
- Inherits:
-
Object
- Object
- RDoc::RD::Inline
- Defined in:
- lib/rdoc/rd/inline.rb
Overview
Inline keeps track of markup and labels to create proper links.
Instance Attribute Summary collapse
-
#rdoc ⇒ Object
(also: #to_s)
readonly
The markup of this reference in RDoc format.
-
#reference ⇒ Object
readonly
The text of the reference.
Class Method Summary collapse
-
.new(rdoc, reference = rdoc) ⇒ Object
Creates a new Inline for
rdocandreference.
Instance Method Summary collapse
-
#==(other) ⇒ Object
:nodoc:.
-
#append(more) ⇒ Object
Appends
moreto this inline. -
#initialize(rdoc, reference) ⇒ Inline
constructor
Initializes the Inline with
rdocandinline. -
#inspect ⇒ Object
:nodoc:.
Constructor Details
#initialize(rdoc, reference) ⇒ Inline
Initializes the Inline with rdoc and inline
36 37 38 39 40 41 42 |
# File 'lib/rdoc/rd/inline.rb', line 36 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 ⇒ Object (readonly) Also known as: to_s
The markup of this reference in RDoc format
17 18 19 |
# File 'lib/rdoc/rd/inline.rb', line 17 def rdoc @rdoc end |
#reference ⇒ Object (readonly)
The text of the reference
12 13 14 |
# File 'lib/rdoc/rd/inline.rb', line 12 def reference @reference end |
Class Method Details
.new(rdoc, reference = rdoc) ⇒ Object
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.
25 26 27 28 29 30 31 |
# File 'lib/rdoc/rd/inline.rb', line 25 def self.new(rdoc, reference = rdoc) if self === rdoc and reference.equal? rdoc rdoc else super end end |
Instance Method Details
#==(other) ⇒ Object
:nodoc:
44 45 46 47 |
# File 'lib/rdoc/rd/inline.rb', line 44 def ==(other) # :nodoc: self.class === other and @reference == other.reference and @rdoc == other.rdoc end |
#append(more) ⇒ Object
Appends more to this inline. more may be a String or another Inline.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rdoc/rd/inline.rb', line 52 def append(more) case more when String @reference += more @rdoc += more when RD::Inline @reference += more.reference @rdoc += more.rdoc else raise "unknown thingy #{more}" end self end |
#inspect ⇒ Object
:nodoc:
67 68 69 |
# File 'lib/rdoc/rd/inline.rb', line 67 def inspect # :nodoc: "(inline: #{self})" end |