E
Eduardo Rocha
Hello guys, i'm new in ruby and i'm trying to create an Address Book.
(I'm from Brasil)
When i put the book to print
"puts lista" #lista is the Address Book
the method to_s of the AddresBook class is like this:
"def to_s
puts "Lista Telefonica"
puts "Numero de Contatos: " + @qtContatos.to_s
@persons.each do |pessoa|
#persons is an array of a Class Person that have it's own to_s method
puts pessoa
puts ""
end
end
"
It's working well, but when I run it in the cmd:
"C:\Users\Dudu\.gem\exe>ruby ListaTelefonica.rb"
(I'm using Windows 7 with Gems version "1.3.5")
The print Returns the & (address) of each thing I print...
example:
"
Nome: My Name
Email: (e-mail address removed)
Fone: XXXXXXX
Endereco:
Rua NumSei, 321
Cidade: Anyone
Pais: Brasil
#<Address:0x2803ae0>
#<Pessoa:0x2803b20>
#<AddressBook:0x28043a0>
"
How can I take this Address out??
this "#<AddressBook:0x28043a0>" and the others
:S
Thanks!!!
(I'm from Brasil)
When i put the book to print
"puts lista" #lista is the Address Book
the method to_s of the AddresBook class is like this:
"def to_s
puts "Lista Telefonica"
puts "Numero de Contatos: " + @qtContatos.to_s
@persons.each do |pessoa|
#persons is an array of a Class Person that have it's own to_s method
puts pessoa
puts ""
end
end
"
It's working well, but when I run it in the cmd:
"C:\Users\Dudu\.gem\exe>ruby ListaTelefonica.rb"
(I'm using Windows 7 with Gems version "1.3.5")
The print Returns the & (address) of each thing I print...
example:
"
Nome: My Name
Email: (e-mail address removed)
Fone: XXXXXXX
Endereco:
Rua NumSei, 321
Cidade: Anyone
Pais: Brasil
#<Address:0x2803ae0>
#<Pessoa:0x2803b20>
#<AddressBook:0x28043a0>
"
How can I take this Address out??
this "#<AddressBook:0x28043a0>" and the others
:S
Thanks!!!