Sha256: 05750ffaa71a8ee7befe64194aa1b0a70e3aebeaeec15cb33dcc12e31a00597b

Contents?: true

Size: 422 Bytes

Versions: 2

Compression:

Stored size: 422 Bytes

Contents

require_relative 'base'

# Namespace for the Taipu library.
module Taipu
  # The type number.
  class Number < Base
    def initialize( min: nil,
                    max: nil )

      if !min.nil? && !max.nil?
        fail 'MinIsGreaterThanMaxError' if min > max
      end

      @min = min
      @max = max

      freeze
    end

    def constraints
      {
        min: @min,
        max: @max
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
taipu-0.0.2 lib/taipu/number.rb
taipu-0.0.1 lib/taipu/number.rb