403Webshell
Server IP : 104.21.38.3  /  Your IP : 172.70.189.164
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/ruby/3.0.0/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/ruby/3.0.0/objspace.rb
# frozen_string_literal: true

require 'objspace.so'

module ObjectSpace
  class << self
    private :_dump
    private :_dump_all
  end

  module_function

  # call-seq:
  #   ObjectSpace.dump(obj[, output: :string]) # => "{ ... }"
  #   ObjectSpace.dump(obj, output: :file)     # => #<File:/tmp/rubyobj20131125-88733-1xkfmpv.json>
  #   ObjectSpace.dump(obj, output: :stdout)   # => nil
  #
  # Dump the contents of a ruby object as JSON.
  #
  # This method is only expected to work with C Ruby.
  # This is an experimental method and is subject to change.
  # In particular, the function signature and output format are
  # not guaranteed to be compatible in future versions of ruby.
  def dump(obj, output: :string)
    out = case output
    when :file, nil
      require 'tempfile'
      Tempfile.create(%w(rubyobj .json))
    when :stdout
      STDOUT
    when :string
      +''
    when IO
      output
    else
      raise ArgumentError, "wrong output option: #{output.inspect}"
    end

    ret = _dump(obj, out)
    return nil if output == :stdout
    ret
  end


  #  call-seq:
  #    ObjectSpace.dump_all([output: :file]) # => #<File:/tmp/rubyheap20131125-88469-laoj3v.json>
  #    ObjectSpace.dump_all(output: :stdout) # => nil
  #    ObjectSpace.dump_all(output: :string) # => "{...}\n{...}\n..."
  #    ObjectSpace.dump_all(output:
  #      File.open('heap.json','w'))         # => #<File:heap.json>
  #    ObjectSpace.dump_all(output: :string,
  #      since: 42)                          # => "{...}\n{...}\n..."
  #
  #  Dump the contents of the ruby heap as JSON.
  #
  #  _since_ must be a non-negative integer or +nil+.
  #
  #  If _since_ is a positive integer, only objects of that generation and
  #  newer generations are dumped. The current generation can be accessed using
  #  GC::count.
  #
  #  Objects that were allocated without object allocation tracing enabled
  #  are ignored. See ::trace_object_allocations for more information and
  #  examples.
  #
  #  If _since_ is omitted or is +nil+, all objects are dumped.
  #
  #  This method is only expected to work with C Ruby.
  #  This is an experimental method and is subject to change.
  #  In particular, the function signature and output format are
  #  not guaranteed to be compatible in future versions of ruby.
  def dump_all(output: :file, full: false, since: nil)
    out = case output
    when :file, nil
      require 'tempfile'
      Tempfile.create(%w(rubyheap .json))
    when :stdout
      STDOUT
    when :string
      +''
    when IO
      output
    else
      raise ArgumentError, "wrong output option: #{output.inspect}"
    end

    ret = _dump_all(out, full, since)
    return nil if output == :stdout
    ret
  end
end

Youez - 2016 - github.com/yon3zu
LinuXploit