On 12/7/05, Steve Litt <slitt / earthlink.net> wrote:
>
> In future software, what could I do to write
> in a more Ruby-like fashion?

This definitely doesn't look like idiomatic Ruby, and here are a few
glaring things I can see:

1. The general naming convention is lowercase with underscores for
variables and methods. You have sort of a mix of "runitalltogether"
variables, i.e. prevsibling, and then the CamelCase methods like
insertSiblingAfterYou. Those should be prev_sibling and
insert_sibling_after_you (though that last one is a bit too long.)

2. Generally when initializing member variables from parameters in
initialize, parallel assignment is used, i.e. "@name, @type, @value =
name, type, value".

3. You have "class Node < Object", which is redundant since classes
subclass object by default:

irb(main):065:0> class Node;end
=> nil
irb(main):066:0> Node.superclass
=> Object

4. There is not a single block used in your code. Ruby without blocks
is like C++ without classes. In other words you can get by, but you
lose A LOT of power and beautiful code. Most of the those loops could
be iterators with blocks, especially this one:

for lineno in 1..lines.length
			line = lines[lineno-1]
...

How about lines.each?

Ryan