Class: Pio::SetVlanPriority

Inherits:
SetVlan
  • Object
show all
Defined in:
lib/pio/set_vlan_priority.rb

Overview

An action to modify the VLAN priority of a packet.

Instance Method Summary collapse

Methods inherited from SetVlan

def_format, read

Constructor Details

#initialize(number) ⇒ SetVlanPriority



8
9
10
11
12
13
14
15
16
# File 'lib/pio/set_vlan_priority.rb', line 8

def initialize(number)
  priority = number.to_i
  if priority < 0 || priority > 7
    fail ArgumentError, 'VLAN priority must be between 0 and 7 inclusive'
  end
  @format = Format.new(vlan_priority: priority)
rescue NoMethodError
  raise TypeError, 'VLAN priority must be an Integer.'
end