Sha256: 0384ae9c56827a9f2a47aa9d1b413b40a3c6c8c0c89170ceb41d02fdff276ef9

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 Bytes

Contents

module Yap
  class ExtendedRange < Range
    def begin
      infinity_or_do_not_change super
    end

    def end
      infinity_or_do_not_change super
    end

    def infinity_or_do_not_change(value)
      if value.is_a? StringInfinity
        if value == String::INFINITY
          Float::INFINITY
        elsif value == -String::INFINITY
          -Float::INFINITY
        else
          raise ArgumentError, "Invalid value for StringInfinity."
        end
      else
        value
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yap-1.4.0 lib/yap/extended_range.rb