superscript 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/e2e/test.rb +2 -5
- data/lib/superscript/ctx.rb +0 -3
- data/lib/superscript/runner.rb +17 -3
- data/lib/superscript/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 319f3dadd5472b2736ea9311eda884988918edc2b6bf85d81e588d82869eefd6
|
4
|
+
data.tar.gz: 442d82b1f0a9038e07c8b1d35a32ba314481d0e2fb3e9bfc6efc828d5ce28236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c73cb8eb01c73067102195d9f3609e0b2bc1c8f7df9691e4c45c58999157609830b75ffe8e1712823942c417ad49231c4aa29c6f19444cad9c3565def98954e6
|
7
|
+
data.tar.gz: 97c3d00746f22289807cbfcc8ab8f94b07a6012df589f31bb28544e91b9564c4af6cbcccbde06ca2c81a9abf14a88485dbfe7680f5a045236b87319c9e798c0e
|
data/Gemfile.lock
CHANGED
data/e2e/test.rb
CHANGED
data/lib/superscript/ctx.rb
CHANGED
data/lib/superscript/runner.rb
CHANGED
@@ -18,10 +18,8 @@ module Superscript
|
|
18
18
|
case where
|
19
19
|
when :exception
|
20
20
|
exception = args.first
|
21
|
-
pp exception
|
22
|
-
pp exception.backtrace_locations
|
23
21
|
error_message = exception
|
24
|
-
when :tp_call_superscript
|
22
|
+
when :tp_call_superscript, :tp_call_superscript_global
|
25
23
|
error_message = "Can't touch this"
|
26
24
|
when :ctx_method_missing, :tp_singleton_method_added, :tp_command_not_found
|
27
25
|
error_message = args.first
|
@@ -50,6 +48,10 @@ module Superscript
|
|
50
48
|
|
51
49
|
def run!(ctx, contents:nil)
|
52
50
|
contents = File.read(@path) unless contents
|
51
|
+
$__superscript_none_of_yer_business = self
|
52
|
+
ctx.define_singleton_method "method_missing" do |*args|
|
53
|
+
$__superscript_none_of_yer_business.error! :ctx_method_missing, "No such command or variable '#{args.first}'"
|
54
|
+
end
|
53
55
|
|
54
56
|
disarm! :at_start
|
55
57
|
trace = TracePoint.new do |tp|
|
@@ -88,6 +90,11 @@ module Superscript
|
|
88
90
|
line = lines[tp.lineno-1].lstrip
|
89
91
|
puts "< #{tp.path}:#{tp.lineno-1}"
|
90
92
|
puts line
|
93
|
+
|
94
|
+
if line.match(/\$__superscript_none_of_yer_business/)
|
95
|
+
tp.disable
|
96
|
+
error! :tp_call_superscript_global
|
97
|
+
end
|
91
98
|
when :c_call
|
92
99
|
# allow calls to these instances
|
93
100
|
if tp.defined_class.ancestors.at(1) == Struct
|
@@ -106,6 +113,8 @@ module Superscript
|
|
106
113
|
end
|
107
114
|
trace.disable
|
108
115
|
error! :tp_singleton_method_added, "Deffining methods is not allowed"
|
116
|
+
when :method_missing
|
117
|
+
trace.disable
|
109
118
|
else
|
110
119
|
trace.disable
|
111
120
|
case tp.defined_class.name
|
@@ -135,6 +144,11 @@ module Superscript
|
|
135
144
|
end
|
136
145
|
end
|
137
146
|
when :call
|
147
|
+
if tp.method_id == :method_missing
|
148
|
+
tp.disable
|
149
|
+
next
|
150
|
+
end
|
151
|
+
|
138
152
|
if tp.defined_class.ancestors.first.to_s == "#<Class:Superscript>"
|
139
153
|
tp.disable
|
140
154
|
error! :tp_call_superscript
|
data/lib/superscript/version.rb
CHANGED