* ArgumentError initializing TCPSocket subclass
@ 2013-12-09 16:58 Luca Molari
2013-12-09 22:58 ` Eric Wong
0 siblings, 1 reply; 2+ messages in thread
From: Luca Molari @ 2013-12-09 16:58 UTC (permalink / raw)
To: kgio
Hello,
I have the following code:
```
require 'kgio'
class KgTCPSocket < Kgio::TCPSocket
def initialize(addr, port, option)
super(addr, port)
end
end
KgTCPSocket.new('127.0.0.1', 8080, true)
# => in `new': wrong number of arguments (3 for 2) (ArgumentError)
```
Could you please tell me what I am doing wrong?
Thank you.
-LM
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ArgumentError initializing TCPSocket subclass
2013-12-09 16:58 ArgumentError initializing TCPSocket subclass Luca Molari
@ 2013-12-09 22:58 ` Eric Wong
0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2013-12-09 22:58 UTC (permalink / raw)
To: kgio
Luca Molari <molari.luca@gmail.com> wrote:
> class KgTCPSocket < Kgio::TCPSocket
> def initialize(addr, port, option)
Try:
def self.new(addr, port, option)
Instead. initialize isn't called for kgio sockets (I don't think it
was the case for any sockets back in the day... things may have
changed).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-09 22:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 16:58 ArgumentError initializing TCPSocket subclass Luca Molari
2013-12-09 22:58 ` Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/kgio.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).