examples/tcp_ip.rb in bindata-2.4.4 vs examples/tcp_ip.rb in bindata-2.4.5
- old
+ new
@@ -12,19 +12,19 @@
# Present MAC addresses in a human readable way
class MacAddr < BinData::Primitive
array :octets, type: :uint8, initial_length: 6
def set(val)
- self.octets = val.split(/\./).collect(&:to_i)
+ self.octets = val.split(/:/).collect(&:to_i)
end
def get
self.octets.collect { |octet| "%02x" % octet }.join(":")
end
end
# Present IP addresses in a human readable way
-class IPAddr < BinData::Primitive
+class IP_Addr < BinData::Primitive
array :octets, type: :uint8, initial_length: 4
def set(val)
self.octets = val.split(/\./).collect(&:to_i)
end