aye_var 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/aye_var/version.rb +1 -1
- data/lib/aye_var.rb +9 -18
- 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: 43fa3e277efd2c75c2c45fbb7fdacfef9fd840a3e1e843ae669b5226ae7b4f59
|
4
|
+
data.tar.gz: 456a214d767e825c3983977923a9bb2c574ac9712eaada1c0a30f349d4aa752e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07f1cde6759331c4f52c24a5bad9f103a73938cbbe4621f2a2cb3296ecad43b52f288cb7f2c939e6ddf5f4622f31eabd27cbba2a7ad9ff0679218b05db397d94
|
7
|
+
data.tar.gz: 5982d8b834e1ccce351d8aad013bbb8687408b5763ef14c403cbe69ca24b7c977006792b19fc7b0e05a73f437a9fc6cbb9be0266e3fb3255d7108c34dd6ff335
|
data/README.md
CHANGED
@@ -23,3 +23,9 @@ AyeVar.init(include: ["#{Dir.pwd}/**/*"])
|
|
23
23
|
```
|
24
24
|
|
25
25
|
Ye can pass an array o’ globs to `include:` an’ `exclude:`, or I’ll feed ye to th’ kraken, ye mangy bilge-suckin’ swab!
|
26
|
+
|
27
|
+
## Uninstall
|
28
|
+
|
29
|
+
By the powers! On account o’ how AyeVar works, ye can cut ’er loose any time without havin’ ta meddle with yer code, ye scurvy dogs! Just cast the gem to Davy Jones’ locker an’ scrub the `AyeVar.init` call from yer charts!
|
30
|
+
|
31
|
+
If ye be usin’ Bootsnap, ye’ll need ta swab yer Bootsnap cache clean by sendin’ `temp/cache/bootsnap` to the briny deep!
|
data/lib/aye_var/version.rb
CHANGED
data/lib/aye_var.rb
CHANGED
@@ -35,7 +35,6 @@ module AyeVar
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def initialize
|
38
|
-
@this = nil
|
39
38
|
@context = Set[]
|
40
39
|
@annotations = []
|
41
40
|
end
|
@@ -43,31 +42,31 @@ module AyeVar
|
|
43
42
|
attr_reader :annotations
|
44
43
|
|
45
44
|
def visit_class_node(node)
|
46
|
-
new_context
|
45
|
+
new_context { super }
|
47
46
|
end
|
48
47
|
|
49
48
|
def visit_module_node(node)
|
50
|
-
new_context
|
49
|
+
new_context { super }
|
51
50
|
end
|
52
51
|
|
53
52
|
def visit_block_node(node)
|
54
|
-
new_context
|
53
|
+
new_context { super }
|
55
54
|
end
|
56
55
|
|
57
56
|
def visit_singleton_class_node(node)
|
58
|
-
new_context
|
57
|
+
new_context { super }
|
59
58
|
end
|
60
59
|
|
61
60
|
def visit_defined_node(node)
|
62
61
|
if Prism::InstanceVariableReadNode === node.value
|
63
|
-
context << node.value.name
|
62
|
+
@context << node.value.name
|
64
63
|
end
|
65
64
|
|
66
65
|
super
|
67
66
|
end
|
68
67
|
|
69
68
|
def visit_def_node(node)
|
70
|
-
new_context
|
69
|
+
new_context { super }
|
71
70
|
end
|
72
71
|
|
73
72
|
def visit_if_node(node)
|
@@ -90,10 +89,10 @@ module AyeVar
|
|
90
89
|
def visit_instance_variable_read_node(node)
|
91
90
|
name = node.name
|
92
91
|
|
93
|
-
unless context.include?(name)
|
92
|
+
unless @context.include?(name)
|
94
93
|
location = node.location
|
95
94
|
|
96
|
-
context << name
|
95
|
+
@context << name
|
97
96
|
|
98
97
|
@annotations << [location.start_character_offset, :start, name]
|
99
98
|
@annotations << [location.end_character_offset, :end, name]
|
@@ -102,17 +101,14 @@ module AyeVar
|
|
102
101
|
super
|
103
102
|
end
|
104
103
|
|
105
|
-
private def new_context
|
106
|
-
original_this = @this
|
104
|
+
private def new_context
|
107
105
|
original_context = @context
|
108
106
|
|
109
|
-
@this = this
|
110
107
|
@context = Set[]
|
111
108
|
|
112
109
|
begin
|
113
110
|
yield
|
114
111
|
ensure
|
115
|
-
@this = original_this
|
116
112
|
@context = original_context
|
117
113
|
end
|
118
114
|
end
|
@@ -127,10 +123,5 @@ module AyeVar
|
|
127
123
|
@context = original_context
|
128
124
|
end
|
129
125
|
end
|
130
|
-
|
131
|
-
# The current context on the stack
|
132
|
-
private def context
|
133
|
-
@context
|
134
|
-
end
|
135
126
|
end
|
136
127
|
end
|