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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03fa28470be7d3daf81b57dfd9e87fd02a9a43980f3ef09dde087e044e39de6e
4
- data.tar.gz: aa3102b743ef7c70aa6fa87d51536ba47303f5dbed871e8d50aadbf9b9109b94
3
+ metadata.gz: 319f3dadd5472b2736ea9311eda884988918edc2b6bf85d81e588d82869eefd6
4
+ data.tar.gz: 442d82b1f0a9038e07c8b1d35a32ba314481d0e2fb3e9bfc6efc828d5ce28236
5
5
  SHA512:
6
- metadata.gz: 300c1faf4ce94007f9d6bb4077414dcef9d5c5ed2d477027d22c531c7c948913d7969fa6151fa7d0c02b69b08f76f48b7445b4ecbfc5fda58b4e635df3e6c80b
7
- data.tar.gz: e0e8aeeb413a3cb079fe11ac30e9933a8770d1e9bea483256951319e92c25ada09bacbda7c9937146672c8e754e5a10707abb643b4833df732edbaa0f8df094b
6
+ metadata.gz: c73cb8eb01c73067102195d9f3609e0b2bc1c8f7df9691e4c45c58999157609830b75ffe8e1712823942c417ad49231c4aa29c6f19444cad9c3565def98954e6
7
+ data.tar.gz: 97c3d00746f22289807cbfcc8ab8f94b07a6012df589f31bb28544e91b9564c4af6cbcccbde06ca2c81a9abf14a88485dbfe7680f5a045236b87319c9e798c0e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superscript (0.6.0)
4
+ superscript (0.7.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/e2e/test.rb CHANGED
@@ -1,5 +1,2 @@
1
- def muna
2
-
3
- end
4
-
5
- muna
1
+ a = struct
2
+ go a.name
@@ -1,7 +1,4 @@
1
1
  module Superscript
2
2
  class Ctx
3
- def method_missing(*args)
4
- ::Superscript.error :ctx_method_missing, "No such command or variable '#{args.first}'"
5
- end
6
3
  end
7
4
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Superscript
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superscript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matti Paksula