ipaddress-gem/ipaddress

undefined method `link_local?' for #<IPAddress::IPv4:0x007fbd8353e880>

Closed this issue · 2 comments

To reproduce

> ip_adr = IPAddress('192.168.0.1')
> ip_adr.link_local?

or

> ip_adr = IPAddress::IPv4.new('192.168.0.1')
> ip_adr.link_local?

I get this error:

NoMethodError: undefined method `link_local?' for #<IPAddress::IPv4:0x007f9c7c790a70>
  from (irb):19
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/railties-4.2.8/lib/rails/commands/console.rb:110:in `start'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/railties-4.2.8/lib/rails/commands/console.rb:9:in `start'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:68:in `console'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `block in require'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require'
  from /Users/redapc/Sites/INSPINIA-WB0R5L90S/easyforce/bin/rails:9:in `<top (required)>'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/commands/rails.rb:6:in `call'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/command_wrapper.rb:38:in `call'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/application.rb:201:in `block in serve'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/application.rb:171:in `serve'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
  from /Users/redapc/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
  from /Users/redapc/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /Users/redapc/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from -e:1:in `<main>'

Support was added in f35aab8. No release of the gem happened since that time, so you'll have to tweak your Gemfile to fetch the gem from GitHub at that commit or a more recent one, e.g.

gem 'ipaddress', git: 'https://github.com/ipaddress-gem/ipaddress.git', commit: 'f35aab8e9109864945f606bef3e135be3763b9c4'

Merci 👍