accessing object contents

M

Mayank Kohaley

[Note: parts of this message were removed to make it a legal post.]

given
=> #<Dnsruby::Name: www.nbc.com.>

what's the proper way of getting to "www.nbc.com."? is it
with the to_s method?

obj.to_s

Override the to_s method in your class and define it to print out the value
of variable. Then you can call to_s method on the object.
 
B

Brian Candler

John Doe wrote in post #988311:
given
=> #<Dnsruby::Name: www.nbc.com.>

Is that output from irb? irb uses the "inspect" method to display a
value.
what's the proper way of getting to "www.nbc.com."?

Depends entirely on the class in question. Look at the documentation for
Dnsruby::Name, or at the source code, to see what methods are available.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top