File: setter.rb

package info (click to toggle)
ruby-backports 3.25.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,912 kB
  • sloc: ruby: 11,757; makefile: 6
file content (22 lines) | stat: -rw-r--r-- 592 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Backports
  TARGET_VERSION = caller.each{|c| break $1 if c =~ /set_version\/(\d\.\d\.\d)\.rb/}
end

unless Object.const_defined?(:Enumerator) || Backports::TARGET_VERSION < '1.9'
  require 'enumerator'
  # Needed for mspec:
  Enumerator = Enumerable::Enumerator
end

if RUBY_VERSION < Backports::TARGET_VERSION && Backports::TARGET_VERSION >= '1.9'
  require 'backports/1.9.2/float/infinity.rb' # Used in many specs...
  require 'backports/1.9.2/float/nan.rb' # Used in many specs...
end

def frozen_error_class
  begin
    [1].freeze.pop
  rescue Exception => e
    e.class
  end
end