Module: RSMP::Inspect
- Included in:
- Archive, ComponentBase, Distributor, Message, Node, Proxy, Receiver
- Defined in:
- lib/rsmp/helpers/inspect.rb
Instance Method Summary collapse
-
#inspect ⇒ Object
override this if you want additional variable to be shown in the short format, or ottherwise change the inspect format.
- #inspector(*short_items) ⇒ Object
Instance Method Details
#inspect ⇒ Object
override this if you want additional variable to be shown in the short format, or ottherwise change the inspect format
38 39 40 |
# File 'lib/rsmp/helpers/inspect.rb', line 38 def inspect "#<#{self.class.name}:#{object_id}, #{inspector}>" end |
#inspector(*short_items) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rsmp/helpers/inspect.rb', line 15 def inspector *short_items instance_variables.map do |var_name| var = instance_variable_get(var_name) class_name = var.class.name short = short_items.include?(var_name) || class_name.start_with?('Async') || class_name.start_with?('RSMP') if short if var.is_a?(Array) || var.is_a?(Hash) "#{var_name}: #<#{class_name}:#{class_name.object_id}, #{var.size} items>" else "#{var_name}: #{var}" end else "#{var_name}: #{var.inspect}" end end.join(', ') end |