petermichaux@yahoo.com wrote:
Hi,
Is there a Ruby beautifier out there that can do more than just
indenting?
Some things I'd like to do are
* change a single line with semi-colon separated statements into
multiple lines with no semi-colons.
* change multi line blocks with {...} to multi line blocks with
do...end
What other features would be good?
The following would be good if the programmer could set the values. Here are some examples of little things...
Change "meth(a)" to "meth( a )"
Change "meth(a,b,c,d)" to "meth( a, b, c, d )"
Put consistency spacing between the end of a \w and the beginning of {
Example:
"arr.each{ |i| .. }" to "arr.each { |i| ... }"
Move multiline conditional statements that only have 1 line of code to 1 line. Example:
if condition
my_obj.do_something_here
end
to:
my_obj.do_something_here if condition
Of source maximum line length may want to be considered.
Change calls like:
method :key1=>val, :key2=>val2
to:
method( :key1=>val, :key2=>val2 )
Also change things like:
method :key1 => val,
:key2 => val,
:key3 =>val
to:
method( :key1 => val,
:key2 => val,
:key3 =>val )
Allow user to specify number of spaces if any between hash key/vals. So:
h = { :key=>:val }
to perhaps:
h = { :key => :val }
or vise versa.
...
Zach