Making all my Ruby files pretty

Hello!

I'm trying to make a simple Ruby code beautifier to set me at ease. I know there's already rbeautify:

http://www.arachnoid.com/ruby/rbeautify.rb.html

But I need to do some more:

Like making,

# comments like these

Into,

Kyrre Nygård wrote:

# comments like these.
# bla bla.
# bla blaaa.

Comments..?

COMMENTS???

Look around you! Do you see any comments in these programs?

(Besides the RDoc meat..:wink:

E.g. making sure the first letter after "^# " (if any) is always uppercase and that every comment line ends with a dot.

[...]

Every comment is always joined into one line.

- Get a list of files you want to "beautify" (e.g. by means of Dir.glob)
- Load the contents of these files
- Use regex to find/replace & upcase for your uppercasing needs
- Save.

Google will be a wonderful resource for all "yeah, but how?" issues you might run into along the way. It will be a brief, yet interesting, programming exercise. Gaining some regex experience never hurts :slight_smile:

Cheers,
Niels

Niels Ganser wrote:

Google will be a wonderful resource for all "yeah, but how?" issues you might run into along the way. It will be a brief, yet interesting, programming exercise. Gaining some regex experience never hurts :slight_smile:

Yeah! What he sed!

Thanks man :slight_smile:

I appreciate it. I wonder why though nobody’s done this kind of thing before.

Where’s the love?

Kyrre