Asked • 06/11/19

How to document Ruby code?

Are there certain code conventions when documenting Ruby code? For example I have the following code snippet: require 'open3' module ProcessUtils # Runs a subprocess and applies handlers for stdout and stderr # Params: # - command: command line string to be executed by the system # - outhandler: proc object that takes a pipe object as first and only param (may be nil) # - errhandler: proc object that takes a pipe object as first and only param (may be nil) def execute_and_handle(command, outhandler, errhandler) Open3.popen3(command) do |_, stdout, stderr| if (outhandler) outhandler.call(stdout) end if (errhandler) errhandler.call(stderr) end end end endThis guess this is okay, but perhaps there are better/superior documentation practices?

1 Expert Answer

By:

Melvin C. answered • 07/29/19

Tutor
5 (2)

Completed Backend Program At The Turing School Of Software And Design

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.