Class: NetAddr::EUI64
Overview
EUI-64 Address - Inherits all methods from NetAddr::EUI. Addresses of this class have a 24-bit OUI and a 40-bit EI.
Instance Method Summary collapse
-
#initialize(eui) ⇒ EUI64
constructor
Synopsis Return an EUI object.
Methods inherited from EUI
#address, create, #ei, #link_local, #oui
Constructor Details
#initialize(eui) ⇒ EUI64
Synopsis
Return an EUI object. PackedEUI takes precedence over EUI.
addr = NetAddr::EUI64.new(‘aa-bb-cc-dd-ee-ff-00-01’)
Arguments:
-
EUI as a String or Integer
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/eui.rb', line 366 def initialize(eui) if (eui.kind_of?(Integer)) @oui = eui >> 40 @ei = eui & 0xffffffffffd elsif(eui.kind_of?(String)) # validate NetAddr.validate_eui(eui) # remove formatting characters eui.gsub!(/[\.\:\-]/, '') # split into oui & ei, pack, and store @oui = eui.slice!(0..5).to_i(16) @ei = eui.to_i(16) else raise ArgumentError, "Expected String or Integer, but #{eui.class} provided." end end |