Hello,

I think you  need to define to_s methods for your
Port, State and Owner classes. These to_s methods
should return a string representation of the class
they belong to (e.g. the state of the current object's
instance variables). The Object#inspect method will
then call these methods when invoked, instead of
calling Object#to_s

hope this helps,

Brian

--- DiesIrae <danb / mojolin.com> wrote:

> Hi all,
> 
> I am storing an array of objects within another
> object, but am not
> sure how to print the values of the array out.  When
> I do an
> Port.inspect, it gives me something like this:
> 
> #<Port:0x4021de58 @state=[#<State:0x4021dca0
> @state="1">,
> #<State:0x4021d8f4 @state="2">], @protocol="tcp",
> @owner=[#<Owner:0x4021d9a8 @name="11">,
> #<Owner:0x4021d854
> @name="12">>
> 
> 
> But when I do a Port.print_port, defined as
> 
>   def print_port 
>     "Port: #{@protocol}, #{@state}, #{@owner} " 
>   end
> 
> it prints:
> 
> Port: tcp, #<State:0x4021dcc8>#<State:0x4021d8cc>,
> #<Owner:0x4021d9d0>#<Owner:0x4021d82c>
> 
> So, How do I address the object with the ID of
> #<State:0x4021dcc8>,
> and print out its constituent values?
> 
> thanks for any help.
> 
> Dan
> 
> 


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail