On Wed, 2003-11-26 at 12:48, Zach Dennis wrote:
I've got a class called Email and right now i have:
class Email
def initialize
....stuff here....
end
def print
return ....stuff here....
end
end
e = Email.new( ...stuff here... )
puts Email.print
But I would love to say:
puts Email
to get the same result.
Any ideas?
You could do something like:
class Email
def initialize(email)
@email = email
end
def to_s
@email
end
end
e = Email.new("bob / mail.com")
puts e
Would that work for you?