Re: Using parenthesis/barackets in ruby

Since you asked… The following is much more readable to me than your
example.

Minor updates to satisfy my own readability scale:
(snip)

FORE!!!

def print_dir(path)
Dir.foreach(path) do |f|
puts “#{File.directory?(f) ? ‘[dir]’ : ’ '*5} #{f}”
end
end

In response to one of the comments in the OP, I think addiction to
parens is
unhealthy and should be cured.

This, coming from a ?: junkie.

sd

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs