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?
That doesn't seem that bad, I'd say as far as conventions it comes down to the company you're at. Some of them might want everything at the top or bottom, hard to say. Find what works best for you and if you find a reason to change your style then do it up!