Sha256: 9e5467fd4665b140770937f92d1e533aa881492792b6c00ee224bc7dd9f79e93

Contents?: true

Size: 1.84 KB

Versions: 1

Compression:

Stored size: 1.84 KB

Contents

### Option ```depth```

This example shows how option ```depth``` affects output.

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

ary = [0,
       [1,
        [2,
         [3,
          [4]
         ]
        ]
       ]
]
(1..5).each do |depth|
  message = "Show depth #{depth}"
  DebugHelper.show(ary, message, {:depth => depth})
end
```

The output shows output for various depths.

```show.yaml```:
```yaml
---
Array (message='Show depth 1'):
  Array#size: 2
  Element 0: Fixnum 0
  Element 1: Array [1, [2, [3, [4]]]]
---
Array (message='Show depth 2'):
  Array#size: 2
  Element 0: Fixnum 0
  Element 1:
    Array:
      Array#size: 2
      Element 0: Fixnum 1
      Element 1: Array [2, [3, [4]]]
---
Array (message='Show depth 3'):
  Array#size: 2
  Element 0: Fixnum 0
  Element 1:
    Array:
      Array#size: 2
      Element 0: Fixnum 1
      Element 1:
        Array:
          Array#size: 2
          Element 0: Fixnum 2
          Element 1: Array [3, [4]]
---
Array (message='Show depth 4'):
  Array#size: 2
  Element 0: Fixnum 0
  Element 1:
    Array:
      Array#size: 2
      Element 0: Fixnum 1
      Element 1:
        Array:
          Array#size: 2
          Element 0: Fixnum 2
          Element 1:
            Array:
              Array#size: 2
              Element 0: Fixnum 3
              Element 1: Array [4]
---
Array (message='Show depth 5'):
  Array#size: 2
  Element 0: Fixnum 0
  Element 1:
    Array:
      Array#size: 2
      Element 0: Fixnum 1
      Element 1:
        Array:
          Array#size: 2
          Element 0: Fixnum 2
          Element 1:
            Array:
              Array#size: 2
              Element 0: Fixnum 3
              Element 1:
                Array:
                  Array#size: 1
                  Element 0: Fixnum 4
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
debug_helper-2.0.0 markdown/readme/options/depth/show.md