Class: MacAddr
- Inherits:
-
BinData::Primitive
- Object
- BinData::Primitive
- MacAddr
- Defined in:
- lib/logstash/codecs/netflow/util.rb
Instance Method Summary collapse
Instance Method Details
#get ⇒ Object
60 61 62 63 64 65 |
# File 'lib/logstash/codecs/netflow/util.rb', line 60 def get # This is currently the fastest implementation # For benchmarks see spec/codecs/benchmarks/MacAddr.rb b = self.bytes.unpack('H*')[0] b[0..1] + ":" + b[2..3] + ":" + b[4..5] + ":" + b[6..7] + ":" + b[8..9] + ":" + b[10..11] end |
#set(val) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/logstash/codecs/netflow/util.rb', line 53 def set(val) unless val.nil? ints = val.split(/:/).collect { |int| int.to_i(16) } self.bytes = ints end end |