HEX
Server: Apache
System: Linux vpshost0650.publiccloud.com.br 4.4.79-grsec-1.lc.x86_64 #1 SMP Wed Aug 2 14:18:21 -03 2017 x86_64
User: bandeirantesbomb3 (10068)
PHP: 8.0.7
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/multi_match.rb
# MultiMatch allows multiple values to be tested at once in a case expression.
# This class is needed since Array does not implement the === operator to mean
# "each v === other.each v". 
#
# This class is useful in situations when the Puppet Type System cannot be used
# (e.g. in Logging, since it needs to be able to log very early in the initialization
# cycle of puppet)
#
# Typically used with the constants
# NOT_NIL
# TUPLE
# TRIPLE
# 
# which test against single NOT_NIL value, Array with two NOT_NIL, and Array with three NOT_NIL
#
module Puppet::Util
class MultiMatch
  attr_reader :values

  def initialize(*values)
    @values = values
  end

  def ===(other)
    lv = @values  # local var is faster than instance var
    case other
    when MultiMatch
      return false unless other.values.size == values.size
      other.values.each_with_index {|v, i| return false unless lv[i] === v || v === lv[i]}
    when Array
      return false unless other.size == values.size
      other.each_with_index {|v, i| return false unless lv[i] === v || v === lv[i]}
    else
      false
    end
    true
  end

  # Matches any value that is not nil using the === operator.
  #
  class MatchNotNil
    def ===(v)
      !v.nil?
    end
  end

  NOT_NIL = MatchNotNil.new().freeze
  TUPLE = MultiMatch.new(NOT_NIL, NOT_NIL).freeze
  TRIPLE = MultiMatch.new(NOT_NIL, NOT_NIL, NOT_NIL).freeze
end
end