Class: Autodoc::Member::Helper

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

Overview

A helper method that wraps a class method.

Helper methods call class methods with simplified signatures. This class generates the RBS signature and RDoc comment.

name

The method name.

class_method

The class method being wrapped.

const_name

The constant name.

Instance Method Summary collapse

Instance Method Details

#rbsObject

Generates an RBS type signature for this helper.

Autodoc writes .rbs files. Each method needs a signature. Helpers forward all arguments to class methods, so they use a generic variadic signature.



96
97
98
# File 'lib/ratatui_ruby/devtools/tasks/autodoc/member.rb', line 96

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

#rdocObject

Generates RDoc comment lines for this helper.

Autodoc writes method documentation. Each method needs a comment. Helpers describe calling a class method. This returns the correctly-formatted comment lines.



105
106
107
108
109
110
111
112
113
# File 'lib/ratatui_ruby/devtools/tasks/autodoc/member.rb', line 105

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