Module: Pio::ClassInspector
- Included in:
- EthernetFrame, EthernetHeader, Icmp::Message
- Defined in:
- lib/pio/class_inspector.rb
Overview
Introduces Class.inspect method
Instance Method Summary collapse
-
#inspect ⇒ Object
rubocop:disable LineLength.
Instance Method Details
#inspect ⇒ Object
rubocop:disable LineLength
9 10 11 12 13 14 15 16 17 |
# File 'lib/pio/class_inspector.rb', line 9 def inspect field_and_type = fields.each_with_object([]) do |each, result| next if each.name == :padding result << [each.name, each.prototype.instance_variable_get(:@obj_class).name.demodulize.sub(/be$/, '').underscore] end signature = field_and_type.map { |field, type| "#{field}: #{type}" }.join(', ') "#{self}(#{signature})" end |