def cidr(options={})
      options.assert_valid_keys(:address_class)

      @address_class = options.fetch(:address_class)

      #
      # Validations
      #

      validates :prefix_length,
                numericality: {
                    only_integer: true,
                    greater_than_or_equal_to: 0,
                    less_than_or_equal_to: maximum_prefix_length
                }
    end
def cidr(options={})
      options.assert_valid_keys(:address_class)

      @address_class = options.fetch(:address_class)

      #
      # Validations
      #

      validates :prefix_length,
                numericality: {
                    only_integer: true,
                    greater_than_or_equal_to: 0,
                    less_than_or_equal_to: maximum_prefix_length
                }
    end
Methods

 @note `address_class` must respond to `#segment_class` and `#segment_count` so {#maximum_prefix_length} can be
   calculated.

 Sets up the address class and allowed {#maximum_prefix_length} for the including `Class`.

 @param options [Hash{Symbol => Class}]
 @option options [Class, #segment_class, #segment_count] :address_class The `Class` whose instances will be used
   for {#address}.