File: ruby_core_support.rb

package info (click to toggle)
ruby-tzinfo 2.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,824 kB
  • sloc: ruby: 21,667; makefile: 6
file content (38 lines) | stat: -rw-r--r-- 1,005 bytes parent folder | download
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 Ruby 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