Documenting scripts with YARD

215 Views Asked by At

Reading the YARD documentation and questions like this one I see this is a very nice tool to document functions, classes, and methods, but I fail to figure out how to document a simple script such as:

# @description Read files in folder and print their sizes
# @author Mefitico
require_relative '../lib/my_funcs'


# Check files in folder and print their sizes:
Dir.entries(Dir.pwd).select do |file|
    if File.file?(file) 
        puts "#{file} - #{File.size(file)} bytes"
    end
end

puts "Finished script"

Doing so generates no documentation whatsoever because no functions or classes are being defined. But for the project I'm working on, I need to create documentation for several standalone scripts which call for functions defined elsewhere. These scripts need to be documented nicely, and cannot be refactored into functions, modules or classes.

0

There are 0 best solutions below