From: Brian Sheehan Date: 2004-09-03T18:10:31+09:00 Subject: Re: array of objects within an object 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 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: > > # @state="1">, > #], @protocol="tcp", > @owner=[#, > # @name="12">> > > > But when I do a Port.print_port, defined as > > def print_port > "Port: #{@protocol}, #{@state}, #{@owner} " > end > > it prints: > > Port: tcp, ##, > ## > > So, How do I address the object with the ID of > #, > 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