Sha256: bba1b8a68e01deaca42090765f73303041e60b70cf85a6adae6dbdc4aee5ea16

Contents?: true

Size: 357 Bytes

Versions: 2

Compression:

Stored size: 357 Bytes

Contents

class Forgery
  module Extensions
    class Range < ::Range

      def unextend
        ::Range.new(first, last, exclude_end?)
      end

      def random
        Integer(first) && Integer(last)
        raise ArgumentError if first > last
        Random.rand self
      rescue ArgumentError
        Forgery::Extend(to_a).random
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
forgery-0.8.1 lib/forgery/extensions/range.rb
forgery-0.7.0 lib/forgery/extensions/range.rb