Class: Pio::Match::MatchIpAddress

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

Overview

IP address

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



98
99
100
# File 'lib/pio/match.rb', line 98

def ==(other)
  get == other
end

#getObject



92
93
94
95
96
# File 'lib/pio/match.rb', line 92

def get
  ipaddr = octets.map { |each| format('%d', each) }.join('.')
  prefixlen = 32 - eval_parameter(:bitcount)
  IPv4Address.new(ipaddr + "/#{prefixlen}")
end

#set(value) ⇒ Object



88
89
90
# File 'lib/pio/match.rb', line 88

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