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/mcollective/aggregate/base.rb
module MCollective
  class Aggregate
    class Base
      attr_accessor :name, :result, :output_name, :action, :aggregate_format, :arguments

      def initialize(output_name, arguments, aggregate_format, action)
        @name = self.class.to_s
        @output_name = output_name

        # Any additional arguments passed in the ddl after the output field will
        # be stored in the arguments array which can be used in the function
        @arguments = arguments
        @aggregate_format = aggregate_format
        @action = action
        @result = {:value => nil, :type => nil, :output => output_name}

        startup_hook
      end

      ['startup_hook', 'process_result'].each do |method|
        define_method method do
          raise RuntimeError, "'#{method}' method of function class #{@name} has not yet been implemented"
        end
      end

      # Stops execution of the function and returns a specific ResultObject,
      # aggregate functions will most likely override this but this is the simplest
      # case so we might as well default to that
      def summarize
        raise "Result type is not set while trying to summarize aggregate function results" unless @result[:type]

        result_class(@result[:type]).new(@result, @aggregate_format, @action)
      end

      def result_class(type)
        Result.const_get("#{type.to_s.capitalize}Result")
      end
    end
  end
end