Class: Autodoc::Member::Delegate

Inherits:
Object
  • Object
show all
Defined in:
lib/ratatui_ruby/devtools/tasks/autodoc/member.rb

Overview

A method that delegates to an identically-named module method.

Some instance methods simply call a module-level method. This class generates the RBS signature and RDoc comment for such methods.

name

The method name.

Instance Method Summary collapse

Instance Method Details

#rbsObject

Generates an RBS type signature for this delegate.

Autodoc writes .rbs files. Each method needs a signature. Delegates forward all arguments, so they use a generic variadic signature.



29
30
31
# File 'lib/ratatui_ruby/devtools/tasks/autodoc/member.rb', line 29

def rbs
  "    def #{name}: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped"
end

#rdocObject

Generates RDoc comment lines for this delegate.

Autodoc writes method documentation. Each method needs a comment. Delegates describe forwarding to the module method. This returns the correctly-formatted comment lines.



38
39
40
41
42
43
44
45
46
# File 'lib/ratatui_ruby/devtools/tasks/autodoc/member.rb', line 38

def rdoc
  [
    "    # :method: #{name}",
    "    # :call-seq: #{name}(*args, **kwargs, &block)",
    "    #",
    "    # Delegates to RatatuiRuby.#{name}.",
    "    #",
  ]
end