Sha256: 407a066fc0e9d1c5c6cef133328c9b75e0d295bbe197958bd366ea6406b5f958

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

#### Nested Structs

This example shows nested structs.

```show.rb```:
```ruby
require 'debug_helper'

MyStruct_0 = Struct.new(:a, :b)
MyStruct_1 = Struct.new(:c, :d)
struct_1a = MyStruct_1.new(2, 3)
struct_1b = MyStruct_1.new(4, 5)
struct_0 = MyStruct_0.new(struct_1a, struct_1b)
DebugHelper.show(struct_0, 'My nested struct')
```

The output shows details of the structs.

```show.yaml```:
```yaml
---
MyStruct_0 (message='My nested struct'):
  MyStruct_0#size: 2
  Member 0:
    Name:
      Symbol:
        Symbol#to_s: a
        Symbol#size: 1
        Symbol#encoding: !ruby/encoding US-ASCII
    Value:
      MyStruct_1:
        MyStruct_1#size: 2
        Member 0:
          Name:
            Symbol:
              Symbol#to_s: c
              Symbol#size: 1
              Symbol#encoding: !ruby/encoding US-ASCII
          Value: Fixnum 2
        Member 1:
          Name:
            Symbol:
              Symbol#to_s: d
              Symbol#size: 1
              Symbol#encoding: !ruby/encoding US-ASCII
          Value: Fixnum 3
  Member 1:
    Name:
      Symbol:
        Symbol#to_s: b
        Symbol#size: 1
        Symbol#encoding: !ruby/encoding US-ASCII
    Value:
      MyStruct_1:
        MyStruct_1#size: 2
        Member 0:
          Name:
            Symbol:
              Symbol#to_s: c
              Symbol#size: 1
              Symbol#encoding: !ruby/encoding US-ASCII
          Value: Fixnum 4
        Member 1:
          Name:
            Symbol:
              Symbol#to_s: d
              Symbol#size: 1
              Symbol#encoding: !ruby/encoding US-ASCII
          Value: Fixnum 5
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
debug_helper-2.0.0 markdown/readme/classes/struct/nested/show.md