Skip to content

Commit eb56066

Browse files
Fix rule for class and module keywords. Class and module methods no longer highlights as class and module keywords. Add tests.
1 parent 2aeab7b commit eb56066

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Syntaxes/Ruby.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<array>
107107
<dict>
108108
<key>begin</key>
109-
<string>\b(class)\b</string>
109+
<string>(?&lt;!^\.|[^.]\.|::)\b(class)\b(?![?!])</string>
110110
<key>beginCaptures</key>
111111
<dict>
112112
<key>1</key>
@@ -223,7 +223,7 @@
223223
</dict>
224224
<dict>
225225
<key>begin</key>
226-
<string>\b(module)\b</string>
226+
<string>(?&lt;!^\.|[^.]\.|::)\b(module)\b(?![?!])</string>
227227
<key>beginCaptures</key>
228228
<dict>
229229
<key>1</key>

Tests/end_distinction.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,23 @@ class Foo
2121
@@module = "mymodule"
2222
class_name = "class_name"
2323
module_name = "module_name"
24+
self.class.methods
25+
self::class::methods
26+
27+
def module
28+
nil
29+
end
30+
31+
def class
32+
nil
33+
end
2434
end
2535

36+
Foo.new.module
37+
Foo.new::module
38+
Foo.new.class
39+
Foo.new::class
40+
2641
# -------------------------------------------
2742
# Testarea for classes
2843
# -------------------------------------------

0 commit comments

Comments
 (0)