Class: PcapTools::Parser::IPAddr

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/pcap_parser.rb

Overview

Present IP addresses in a human readable way

Instance Method Summary collapse

Instance Method Details

#getObject



45
46
47
# File 'lib/pcap_parser.rb', line 45

def get
  self.octets.collect { |octet| "%d" % octet }.join(".")
end

#set(val) ⇒ Object



40
41
42
43
# File 'lib/pcap_parser.rb', line 40

def set(val)
  ints = val.split(/\./).collect { |int| int.to_i }
  self.octets = ints
end