Cary Swoveland wrote:
...
> One easy tech question follow.
> 
> class Node
>   attr_reader :row
>   def initialize(r)
>     row = r
>   end
> end
> 
> n = Node.new(0)
> puts "n = #{n}"
> 
> I expected
>    n = 0
> but instead, Ruby says
>    n = #<Node:0x100156480>
> ?
> 
> Cary

You probably want to print n.row , which returns nil in your code 
because of a previous error: row = r should be @row = r.

When I was really new to ruby it paid off to write out the setters and 
getters by hand. It got boring so fast I happily switched to the 
attr_accessor tricks, but with better understanding.

hth,

Siep
-- 
Posted via http://www.ruby-forum.com/.