Class: IP4Addr
- Inherits:
-
BinData::Primitive
- Object
- BinData::Primitive
- IP4Addr
- Defined in:
- lib/logstash/codecs/netflow/util.rb
Instance Method Summary collapse
Instance Method Details
#get ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/logstash/codecs/netflow/util.rb', line 15 def get # This is currently the fastest implementation # For benchmarks see spec/codecs/benchmarks/IPaddr.rb unless self.storage.nil? [self.storage].pack('N').unpack('C4').join('.') end end |
#set(val) ⇒ Object
9 10 11 12 13 |
# File 'lib/logstash/codecs/netflow/util.rb', line 9 def set(val) unless val.nil? self.storage = val.split('.').inject(0) {|total,value| (total << 8 ) + value.to_i} end end |