Module: Hglib::Inspection

Included in:
Extension::Topic::Entry, Extension::Topic::StackEntry
Defined in:
lib/hglib/mixins.rb

Overview

An extensible #inspect for Hglib objects.

Instance Method Summary collapse

Instance Method Details

#inspectObject

Return a human-readable representation of the object suitable for debugging.



83
84
85
86
87
88
89
# File 'lib/hglib/mixins.rb', line 83

def inspect
  return "#<%p:%#016x %s>" % [
    self.class,
    self.object_id * 2,
    self.inspect_details,
  ]
end

#inspect_detailsObject

Return the detail portion of the inspect output for this object.



93
94
95
96
97
# File 'lib/hglib/mixins.rb', line 93

def inspect_details
  return self.instance_variables.sort.map do |ivar|
    "%s=%p" % [ ivar, self.instance_variable_get(ivar) ]
  end.join( ', ' )
end