module Axiom::Attribute::ValueComparable

A mixin for attributes that have comparable values

Public Class Methods

new(_name, options = EMPTY_HASH) click to toggle source

Initialize a value comparable attribute

@param [#to_sym] _name

the attribute name

@param [#to_hash] options

the options for the attribute

@option options [Boolean] :required (true)

if true, then the value cannot be nil

@option options [Range<::Numeric>] :size

The numeric range for a valid value

@return [undefined]

@api private

Calls superclass method
# File lib/axiom/attribute/value_comparable.rb, line 29
def initialize(_name, options = EMPTY_HASH)
  super
  size = options[:size]
  if size
    @type = type.new do
      minimum(size.first)
      maximum(size.last)
    end
  end
end