Module: Asciidoctor::InterdocReftext::InlineNodeMixin

Defined in:
lib/asciidoctor/interdoc_reftext/inline_node_mixin.rb

Overview

Mixin intended to be prepended into Asciidoctor::Inline.

It modifies the method #text to resolve the value via Resolver if it's not set, this node is an inline_anchor and has attribute path (i.e. represents an inter-document cross reference).

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base_klass) ⇒ void

Opal does not support Module#prepend, so we have to fallback to include with poor alias method chain approach.



16
17
18
19
20
21
# File 'lib/asciidoctor/interdoc_reftext/inline_node_mixin.rb', line 16

def self.included(base_klass)
  base_klass.send(:alias_method, :text_without_reftext, :text)
  base_klass.send(:define_method, :text) do
    text_without_reftext || interdoc_reftext
  end
end

Instance Method Details

#textvoid

Note:

This method will override the same name attribute reader in class Asciidoctor::Inline.

Returns text of this inline element.



27
28
29
# File 'lib/asciidoctor/interdoc_reftext/inline_node_mixin.rb', line 27

def text
  super || interdoc_reftext
end