Sha256: 887ce999903eca09745b28caeb430b56bddf98c0210ffa8d2c649f73accb2597

Contents?: true

Size: 405 Bytes

Versions: 2

Compression:

Stored size: 405 Bytes

Contents

module Yap
  ##
  # Extends Range by StringInfinity.
  #
  class ExtendedRange < Range
    def begin
      handle_infinity super
    end

    def end
      handle_infinity super
    end

    def handle_infinity(value)
      return value unless value.is_a? StringInfinity

      if value.is_a?(StringInfinityNegative)
        -Float::INFINITY
      else
        Float::INFINITY
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yap-2.0.0 lib/yap/extended_range.rb
yap-1.4.2 lib/yap/extended_range.rb