summaryrefslogtreecommitdiff
path: root/sample/evaldef.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/evaldef.rb')
-rw-r--r--sample/evaldef.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/sample/evaldef.rb b/sample/evaldef.rb
new file mode 100644
index 0000000..c261b53
--- /dev/null
+++ b/sample/evaldef.rb
@@ -0,0 +1,21 @@
+class foo
+ def foo
+ eval("
+def baz
+ print(\"bar\n\")
+end")
+ end
+end
+
+class bar:foo
+ def bar
+ baz()
+ end
+end
+
+f = foo.new
+b = bar.new
+
+b.foo
+b.bar
+f.baz