-
Notifications
You must be signed in to change notification settings - Fork 101
/
ruby_core_support.rb
38 lines (33 loc) · 1000 Bytes
/
ruby_core_support.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module TZInfo
# Methods to support different versions of Ruby.
#
# @private
module RubyCoreSupport #:nodoc:
class << self
# Object#untaint is deprecated and becomes a no-op in Ruby >= 2.7. It has
# been removed from 3.2.
if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3)
# :nocov_functional_untaint:
# Returns the supplied `Object`
#
# @param o [Object] the `Object` to untaint.
# @return [Object] `o`.
def untaint(o)
o
end
# :nocov_functional_untaint:
else
# :nocov_no_functional_untaint:
# Untaints and returns the supplied `Object`.
#
# @param o [Object] the `Object` to untaint.
# @return [Object] `o`.
def untaint(o)
o.untaint
end
# :nocov_no_functional_untaint:
end
end
end
private_constant :RubyCoreSupport
end