Class: CTioga2::Commands::Documentation::MarkedUpText::MarkupLink

Inherits:
MarkupItem
  • Object
show all
Defined in:
lib/ctioga2/commands/doc/markup.rb

Overview

A link to a type/group/command

Instance Attribute Summary collapse

Attributes inherited from MarkupItem

#doc

Instance Method Summary collapse

Constructor Details

#initialize(doc, target, type) ⇒ MarkupLink

target is the name of the target, which can be of type ‘group’, ‘command’, ‘backend’, ‘type’ and ‘url’



114
115
116
117
118
119
120
121
# File 'lib/ctioga2/commands/doc/markup.rb', line 114

def initialize(doc, target, type)
  super(doc)
  if type =~ /url/
    @target = target
  else
    @target = doc.send("#{type}s")[target]
  end
end

Instance Attribute Details

#targetObject

The object target of the link



110
111
112
# File 'lib/ctioga2/commands/doc/markup.rb', line 110

def target
  @target
end

Instance Method Details

#dump_stringObject



135
136
137
# File 'lib/ctioga2/commands/doc/markup.rb', line 135

def dump_string
  return "link: #{@target}"
end

#to_sObject



123
124
125
126
127
128
129
130
131
132
133
# File 'lib/ctioga2/commands/doc/markup.rb', line 123

def to_s
  if @target 
    begin
      return @target.name
    rescue NoMethodError
      return @target
    end
  else
    return "unknown"
  end
end