Skip to content

Commit 017cc54

Browse files
committed
add Ruby demo
1 parent 5668efb commit 017cc54

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

demos/ruby/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ruby Demos
2+
3+
To visualize Ruby objects, you need to install [debugvisualizer.gem](https://github.com/ono-max/debugvisualizer).
4+
5+
Install the gem by executing:
6+
7+
$ gem install debugvisualizer
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require 'debugvisualizer'
2+
3+
class Foo; end
4+
5+
DebugVisualizer.register Foo do |data|
6+
{
7+
id: "my_visualizer",
8+
name: "My Visualizer",
9+
data: {
10+
kind: { text: true },
11+
text: "Foo"
12+
}
13+
}
14+
end
15+
16+
f = Foo.new
17+
# visualize `f` here!
18+
binding.break

demos/ruby/src/demo_random_walks.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
data = []
2+
curVal = 0
3+
4+
100.times{
5+
100.times{
6+
delta = rand > 0.5 ? 1 : -1
7+
data << curVal
8+
curVal += delta
9+
# visualize `data` here and press F5(or Continue button) over and over!
10+
binding.break
11+
}
12+
}

extension/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ See [demos](../demos/) for demos. These languages and debuggers are verified to
2525
- C++ using `cppdbg` debug adapter: [✅ Basic Support](../demos/cpp)
2626
- Swift using `lldb` debug adapter: [✅ Basic Support](../demos/swift)
2727
- Rust using `lldb` debug adapter: [✅ Basic Support](../demos/rust)
28-
- Ruby using `rdbg` debug adapter: [✅ Basic Support]
28+
- Ruby using `rdbg` debug adapter: [✅ Basic Support](../demos/ruby)
2929

3030
All other languages and debuggers might work too.
3131
For languages with _Basic Support_, only JSON strings can be visualized - you must implement some logic that builds this JSON for your data structure!

0 commit comments

Comments
 (0)