Class: Ukiryu::Definition::DocumentationGenerator
- Inherits:
-
Object
- Object
- Ukiryu::Definition::DocumentationGenerator
- Defined in:
- lib/ukiryu/definition/documentation_generator.rb
Overview
Generate documentation from tool definitions
This class generates human-readable documentation from tool definitions in various formats (Markdown, AsciiDoc).
Constant Summary collapse
- FORMATS =
Supported formats
%i[markdown asciidoc md].freeze
Class Method Summary collapse
-
.generate(definition, format: :markdown) ⇒ String
Generate documentation for a definition.
-
.generate_command_docs(command_name, command_def, format: :markdown) ⇒ String
Generate documentation for a specific command.
-
.generate_to_file(definition, file_path, format: :markdown) ⇒ Object
Generate documentation to a file.
Class Method Details
.generate(definition, format: :markdown) ⇒ String
Generate documentation for a definition
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ukiryu/definition/documentation_generator.rb', line 19 def generate(definition, format: :markdown) format = normalize_format(format) case format when :markdown generate_markdown(definition) when :asciidoc generate_asciidoc(definition) else raise ArgumentError, "Unsupported format: #{format}" end end |
.generate_command_docs(command_name, command_def, format: :markdown) ⇒ String
Generate documentation for a specific command
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ukiryu/definition/documentation_generator.rb', line 48 def generate_command_docs(command_name, command_def, format: :markdown) format = normalize_format(format) case format when :markdown generate_command_markdown(command_name, command_def) when :asciidoc generate_command_asciidoc(command_name, command_def) else raise ArgumentError, "Unsupported format: #{format}" end end |
.generate_to_file(definition, file_path, format: :markdown) ⇒ Object
Generate documentation to a file
37 38 39 40 |
# File 'lib/ukiryu/definition/documentation_generator.rb', line 37 def generate_to_file(definition, file_path, format: :markdown) content = generate(definition, format: format) File.write(file_path, content) end |