module Redstruct::Utils::Inspectable

Adds helper methods for calling inspect on a custom object

Public Instance Methods

inspect() click to toggle source

Generates a human readable list of attributes when inspecting a custom object @return [String]

# File lib/redstruct/utils/inspectable.rb, line 9
def inspect
  attributes = inspectable_attributes.map do |key, value|
    "#{key}: <#{value.inspect}>"
  end

  return "#{self.class.name}: #{attributes.join(', ')}"
end
Also aliased as: to_s
inspectable_attributes() click to toggle source

To be overloaded by the including class @return [Hash<String, inspect>] list of attributes that can be seen

# File lib/redstruct/utils/inspectable.rb, line 20
def inspectable_attributes
  {}
end
to_s()
Alias for: inspect