Class: ACLIdASA

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/logstash/codecs/netflow/util.rb

Instance Method Summary collapse

Instance Method Details

#getObject



107
108
109
110
111
112
# File 'lib/logstash/codecs/netflow/util.rb', line 107

def get
  # This is currently the fastest implementation
  # For benchmarks see spec/codecs/benchmarks/ACLIdASA.rb
  b = self.bytes.unpack('H*')[0]
  b[0..7] + "-" + b[8..15] + "-" + b[16..23] 
end

#set(val) ⇒ Object



101
102
103
104
105
# File 'lib/logstash/codecs/netflow/util.rb', line 101

def set(val)
  unless val.nil?
    self.bytes = val.split("-").collect { |aclid| aclid.scan(/../).collect { |hex| hex.to_i(16)} }.flatten
  end
end