class HeapInfo::Nil

Self define a nil like class.

Can be the return value of {HeapInfo::Process#dump} and {HeapInfo::Process#dump_chunks}, to prevent use the return value for calculating accidentally while exploiting remote.

Public Instance Methods

method_missing(method_sym, *args, &block) click to toggle source

Hook all missing methods @return [HeapInfo::Nil] return self so that it can be a nil chain. @example

# h.dump would return Nil when process not found
p h.dump(:heap)[8, 8].unpack('Q*')
#=> nil
Calls superclass method
# File lib/heapinfo/nil.rb, line 17
def method_missing(method_sym, *args, &block)
  return nil.__send__(method_sym, *args, &block) if nil.respond_to?(method_sym)
  self || super
end
respond_to_missing?(*) click to toggle source

Yap

Calls superclass method
# File lib/heapinfo/nil.rb, line 23
def respond_to_missing?(*)
  super
end
to_ary() click to toggle source

To prevent error raised when using +puts Nil.new+. @return [Array] Empty array

# File lib/heapinfo/nil.rb, line 29
def to_ary
  []
end