lib/packetgen/header/eth.rb in packetgen-3.1.4 vs lib/packetgen/header/eth.rb in packetgen-3.1.5

- old
+ new

@@ -31,10 +31,12 @@ # @author Sylvain Daubert class Eth < Base # Ethernet MAC address, as a group of 6 bytes # @author Sylvain Daubert class MacAddr < Types::Fields + include Inspectable + # @!attribute a0 # @return [Integer] first byte from MacAddr define_field :a0, Types::Int8 # @!attribute a1 # @return [Integer] second byte from MacAddr @@ -73,9 +75,10 @@ # +MacAddr+ in human readable form (colon format) # @return [String] def to_human fields.map { |m| '%02x' % self[m] }.join(':') end + alias format_inspect to_human def ==(other) other.is_a?(self.class) && fields.all? { |attr| self[attr].value == other[attr].value } end