5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/display.rb', line 5
def display *args
a = caller
last_caller = a[0]
if last_caller[1..1] == ":"
drive, file, line, *rest = last_caller.split(":")
else
file, line, *rest = last_caller.split(":")
end
if(file.include?('eval'))
out = '[eval] '
names = args.map{|a| '?'}
else
exact_line = File.readlines(file)[line.to_i - 1].strip
parser = RedParse.new(exact_line)
tree = parser.parse
right_call_node = give_me_first_call_node tree
names = right_call_node.params.map{|p| p.unparse}
out = "[#{File.basename(file)},#{line}] "
end
args2 = names.map{ |n|
"#{n}=#{args.shift.inspect}"
}.join(', ')
out += args2
puts out
out
end
|