Class: YARD::Aggredator::EmbedDirective

Inherits:
ReferenceableDirective show all
Defined in:
lib/yard/aggredator/plugin.rb

Instance Attribute Summary

Attributes inherited from ReferenceableDirective

#reference, #uuid

Instance Method Summary collapse

Methods inherited from ReferenceableDirective

#call, #detect_reference, #directives_from_reference, #initialize, #name, #reference?

Constructor Details

This class inherits a constructor from YARD::Aggredator::ReferenceableDirective

Instance Method Details

#expandObject



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/yard/aggredator/plugin.rb', line 299

def expand
  if reference?
    result = if (r = directives_from_reference.first&.expand)
               r
             else
               "<code>see [#{name}] #{reference}</code>"
             end
    return result
  end

  root = YARD::Registry.send(:thread_local_store).file.to_s
  if (finded = Aggredator::Helper.find_static_file(tag.text.to_s, root: root))
    File.read(finded)
  else
    "<code>@!embed #{tag.text}</code>"
  end
end