ruby/trema/set-vlan-vid.rb in trema-0.2.5 vs ruby/trema/set-vlan-vid.rb in trema-0.2.6
- old
+ new
@@ -22,10 +22,11 @@
module Trema
#
# An action to modify the VLAN ID of a packet.
#
class SetVlanVid < Action
+ # @return [Fixnum] the value of attribute {#vlan_id}
attr_reader :vlan_id
#
# Creates an action to modify the VLAN ID of a packet. The VLAN ID
@@ -36,18 +37,18 @@
# ActionSetVlanVid.new( vlan_id )
#
# @param [Integer] vlan_id
# the VLAN ID to set to. Only the lower 12-bits are used.
#
- # @raise [ArgumentError] if vlan_id not within 1 and 4096 inclusive.
+ # @raise [ArgumentError] if vlan_id not within 1 and 4095 inclusive.
# @raise [TypeError] if vlan_id is not an Integer.
#
def initialize vlan_id
- if not vlan_id.is_a?( Integer )
+ unless vlan_id.is_a?( Integer )
raise TypeError, "VLAN ID argument must be an Integer"
end
- if not ( vlan_id >= 1 and vlan_id <= 4096 )
- raise ArgumentError, "Valid VLAN ID values between 1 to 4096 inclusive"
+ unless ( vlan_id >= 1 and vlan_id <= 4095 )
+ raise ArgumentError, "Valid VLAN ID values between 1 to 4095 inclusive"
end
@vlan_id = vlan_id
end
end