7
demos/ruby/README.md
Normal file
7
demos/ruby/README.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Ruby Demos
|
||||||
|
|
||||||
|
To visualize Ruby objects, you need to install [debugvisualizer.gem](https://github.com/ono-max/debugvisualizer).
|
||||||
|
|
||||||
|
Install the gem by executing:
|
||||||
|
|
||||||
|
$ gem install debugvisualizer
|
||||||
18
demos/ruby/src/demo_custom_visualizer.rb
Normal file
18
demos/ruby/src/demo_custom_visualizer.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
require 'debugvisualizer'
|
||||||
|
|
||||||
|
class Foo; end
|
||||||
|
|
||||||
|
DebugVisualizer.register Foo do |data|
|
||||||
|
{
|
||||||
|
id: "my_visualizer",
|
||||||
|
name: "My Visualizer",
|
||||||
|
data: {
|
||||||
|
kind: { text: true },
|
||||||
|
text: "Foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
f = Foo.new
|
||||||
|
# visualize `f` here!
|
||||||
|
binding.break
|
||||||
12
demos/ruby/src/demo_random_walks.rb
Normal file
12
demos/ruby/src/demo_random_walks.rb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
data = []
|
||||||
|
curVal = 0
|
||||||
|
|
||||||
|
100.times{
|
||||||
|
100.times{
|
||||||
|
delta = rand > 0.5 ? 1 : -1
|
||||||
|
data << curVal
|
||||||
|
curVal += delta
|
||||||
|
# visualize `data` here and press F5(or Continue button) over and over!
|
||||||
|
binding.break
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ See [demos](../demos/) for demos. These languages and debuggers are verified to
|
|||||||
- C++ using `cppdbg` debug adapter: [✅ Basic Support](../demos/cpp)
|
- C++ using `cppdbg` debug adapter: [✅ Basic Support](../demos/cpp)
|
||||||
- Swift using `lldb` debug adapter: [✅ Basic Support](../demos/swift)
|
- Swift using `lldb` debug adapter: [✅ Basic Support](../demos/swift)
|
||||||
- Rust using `lldb` debug adapter: [✅ Basic Support](../demos/rust)
|
- Rust using `lldb` debug adapter: [✅ Basic Support](../demos/rust)
|
||||||
- Ruby using `rdbg` debug adapter: [✅ Basic Support]
|
- Ruby using `rdbg` debug adapter: [✅ Basic Support](../demos/ruby)
|
||||||
|
|
||||||
All other languages and debuggers might work too.
|
All other languages and debuggers might work too.
|
||||||
For languages with _Basic Support_, only JSON strings can be visualized - you must implement some logic that builds this JSON for your data structure!
|
For languages with _Basic Support_, only JSON strings can be visualized - you must implement some logic that builds this JSON for your data structure!
|
||||||
|
|||||||
Reference in New Issue
Block a user