Module: Redstruct::Utils::Inspectable
- Included in:
- ConnectionProxy, Factory, Factory::Object
- Defined in:
- lib/redstruct/utils/inspectable.rb
Overview
Adds helper methods for calling #inspect on a custom object
Instance Method Summary collapse
-
#inspect ⇒ String
(also: #to_s)
Generates a human readable list of attributes when inspecting a custom object.
-
#inspectable_attributes ⇒ Hash<String, #inspect>
To be overloaded by the including class.
Instance Method Details
#inspect ⇒ String Also known as: to_s
Generates a human readable list of attributes when inspecting a custom object
9 10 11 12 13 14 15 |
# 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 |