Skip to content

problems subclassing ip #23

@Canx

Description

@Canx

Hi,

thanks for sharing this great library!

I'm trying to inherit from IP but I've got problems with the constructor:

$ ruby ip_extended.rb 
/var/lib/gems/2.3.0/gems/ruby-ip-0.9.3/lib/ip/base.rb:22:in `new': wrong number of arguments (given 3, expected 1) (ArgumentError)
        from ip_extended.rb:9:in `<main>'

The code:

require 'ip'

class IPExtended < IP
  def initialize(ip, param2, param3)
    super(ip)
  end
end

ip = IPExtended.new("192.168.1.1", true, true)
puts ip.to_s

I don't know what I'm doing wrong, could you help me please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions