Class: Pio::Type::EtherType
- Inherits:
-
BinData::Primitive
- Object
- BinData::Primitive
- Pio::Type::EtherType
- Defined in:
- lib/pio/type/ether_type.rb
Overview
Ether type
Instance Method Summary collapse
- #get ⇒ Object
- #inspect ⇒ Object
- #set(value) ⇒ Object
-
#to_bytes ⇒ Object
This method smells of :reek:UncommunicativeVariableName.
Instance Method Details
#get ⇒ Object
17 18 19 |
# File 'lib/pio/type/ether_type.rb', line 17 def get ether_type end |
#inspect ⇒ Object
28 29 30 |
# File 'lib/pio/type/ether_type.rb', line 28 def inspect Kernel.format '0x%04x', self end |
#set(value) ⇒ Object
13 14 15 |
# File 'lib/pio/type/ether_type.rb', line 13 def set(value) self.ether_type = value end |
#to_bytes ⇒ Object
This method smells of :reek:UncommunicativeVariableName
22 23 24 25 26 |
# File 'lib/pio/type/ether_type.rb', line 22 def to_bytes byte1 = format('%02x', (self & 0xff00) >> 8) byte2 = format('%02x', self & 0xff) "0x#{byte1}, 0x#{byte2}" end |