Class: Autodoc::Member::Factory
- Inherits:
-
Object
- Object
- Autodoc::Member::Factory
- Defined in:
- lib/ratatui_ruby/devtools/tasks/autodoc/member.rb
Overview
A factory method that creates instances of a widget class.
Factory methods like paragraph create Paragraph.new. This class generates the RBS signature and RDoc comment.
- name
-
The method name.
- const_name
-
The constant name (e.g.,
Paragraph).
Instance Method Summary collapse
-
#rbs ⇒ Object
Generates an RBS type signature for this factory.
-
#rdoc ⇒ Object
Generates RDoc comment lines for this factory.
Instance Method Details
#rbs ⇒ Object
Generates an RBS type signature for this factory.
Autodoc writes .rbs files. Each method needs a signature. Factories forward all arguments to constructors, so they use a generic variadic signature.
62 63 64 |
# File 'lib/ratatui_ruby/devtools/tasks/autodoc/member.rb', line 62 def rbs " def #{name}: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped" end |
#rdoc ⇒ Object
Generates RDoc comment lines for this factory.
Autodoc writes method documentation. Each method needs a comment. Factories describe creating a widget instance. This returns the correctly-formatted comment lines.
71 72 73 74 75 76 77 78 79 |
# File 'lib/ratatui_ruby/devtools/tasks/autodoc/member.rb', line 71 def rdoc [ " # :method: #{name}", " # :call-seq: #{name}(*args, **kwargs, &block)", " #", " # Factory for RatatuiRuby::#{const_name}.new.", " #", ] end |