Class: BGPView::Number

Inherits:
Object
  • Object
show all
Defined in:
lib/bgpview/number.rb

Class Method Summary collapse

Class Method Details

.check(number) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/bgpview/number.rb', line 7

def self.check(number)
  unless number.is_a? Integer
    raise InvalidASNumber, 'AS Number is only Integer'
  end
  if number.negative? || number >= 4_294_967_296
    raise InvalidASNumber, 'AS Number is 4 bytes'
  end

  true
end