module BetterIpaddr::HostMethods

Methods included in IPAddr::IPV4::Host and IPAddr::IPV6::Host

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/better_ipaddr/host_methods.rb, line 4
def initialize(*)
  super
  @mask_addr = netmask.to_i
end

Public Instance Methods

cover?(other) click to toggle source

Returns true if the argument is the same as the receiver, false otherwise.

# File lib/better_ipaddr/host_methods.rb, line 11
def cover?(other)
  self == other
end
each() { |self| ... } click to toggle source

@overload each

Return an enumerator with the behavior described above.
@return [Enumerator]
# File lib/better_ipaddr/host_methods.rb, line 24
def each
  if block_given?
    yield self
  else
    enum_for(:each)
  end
end
first() click to toggle source

Returns the object. @return [IPAddr]

# File lib/better_ipaddr/host_methods.rb, line 35
def first
  self
end
host?() click to toggle source

Returns true.

# File lib/better_ipaddr/host_methods.rb, line 41
def host?
  true
end
inspect(cidr: false, full: false) click to toggle source

Same as BetterIpaddr::InstanceMethods#inspect but doesn't by default include the CIDR prefix length.

@return String

# File lib/better_ipaddr/kernel_method.rb, line 34
def inspect(cidr: false, full: false)
  "#{self.class}['#{better_to_s(cidr: cidr, full: full)}']"
end
last() click to toggle source

Returns the object. @return [IPAddr]

# File lib/better_ipaddr/host_methods.rb, line 48
def last
  self
end
netmask() click to toggle source

Returns the netmask for a host address.

# File lib/better_ipaddr/host_methods.rb, line 53
def netmask
  self.class::HOST_NETMASK
end
prefix_length() click to toggle source

Returns the number of bits in the address.

# File lib/better_ipaddr/host_methods.rb, line 58
def prefix_length
  self.class::BIT_LENGTH
end
size() click to toggle source

Returns 1.

# File lib/better_ipaddr/host_methods.rb, line 63
def size
  1
end