Skip to content

Commit 6c344e6

Browse files
committed
bam
1 parent 57d6258 commit 6c344e6

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎v4-cokapi/backends/ruby/notes.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ ancestors' methods!
7272
we need to display 'module' contents and how a class includes (points
7373
to) a module, since that's a central concept for mixins
7474

75+
interesting -- classes can be 'opened' multiple times and have stuff
76+
added to them (even stdlib classes)
77+
7578

7679
it looks like we should target Ruby 2.X since there's the TracePoint
7780
class for easy tracing:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Ruby backend for Online "Python" Tutor
2+
# created on 2015-06-29 by Philip Guo
3+
#
4+
# only works on Ruby 2.X since we use the TracePoint API
5+
6+
script_name = ARGV[0]
7+
8+
trace = TracePoint.new(:line,:class,:end,:call,:return,:raise,:b_call,:b_return) do |tp|
9+
if tp.path == '(eval)'
10+
p [tp.event, tp.lineno]
11+
end
12+
end
13+
14+
trace.enable
15+
eval(File.open(script_name).read) # filename is called '(eval)'
16+
trace.disable

0 commit comments

Comments
 (0)