Sha256: b1202c812de9e4b23e0194ec3e9d6f6d49e3d5e88c4ae276f96381b7f512b6fd
Contents?: true
Size: 649 Bytes
Versions: 1
Compression:
Stored size: 649 Bytes
Contents
# frozen_string_literal: true require 'dry-types' require_relative './range' # `Types` as a top-level namespace module seems to be a `dry-types` convention. module Types include Dry::Types.module # should have already been included # The original version of this type treated initialisation with an integer # value of zero as invalid, setting the initialised range to (-1..-1). On # reflection, this makes little sense as a general-purpose behaviour, as it is # highly likely to surprise casual users. IntegerRange = Range.constructor do |value| if value.is_a?(::Range) value else 0..value.to_i end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prolog-dry_types-0.1.0 | lib/prolog/dry_types/integer_range.rb |