Sha256: 1a6366125ce4e810bb205c3c232b0685b2a1e38b150fdba886fba87b712ad3d2

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 KB

Contents

#### Nested OpenStructs

This example shows nested open structs.

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

ostruct = OpenStruct.new(
                        :a => OpenStruct.new(
                                            :b => 0,
                                            :c => 1,
                        ),
                        :d => OpenStruct.new(
                                            :e => 2,
                                            :f => 3,
                        )
)
DebugHelper.show(ostruct, 'My nested struct')
```

The output shows details of the open structs.

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

Version data entries

1 entries across 1 versions & 1 rubygems

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