Class: Pio::Type::IpAddress

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/pio/type/ip_address.rb

Overview

IP address

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/pio/type/ip_address.rb', line 18

def ==(other)
  get == other
end

#getObject



14
15
16
# File 'lib/pio/type/ip_address.rb', line 14

def get
  IPv4Address.new(octets.map { |each| format('%d', each) }.join('.'))
end

#set(value) ⇒ Object



10
11
12
# File 'lib/pio/type/ip_address.rb', line 10

def set(value)
  self.octets = IPv4Address.new(value).to_a
end