From eb56066d199e679a18a2e9d9a9d1c052baeda719 Mon Sep 17 00:00:00 2001 From: Graceful Potato Date: Mon, 17 Feb 2020 17:43:46 +0300 Subject: [PATCH] Fix rule for class and module keywords. Class and module methods no longer highlights as class and module keywords. Add tests. --- Syntaxes/Ruby.plist | 4 ++-- Tests/end_distinction.rb | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 26ce57c..2db86ad 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -106,7 +106,7 @@ begin - \b(class)\b + (?<!^\.|[^.]\.|::)\b(class)\b(?![?!]) beginCaptures 1 @@ -223,7 +223,7 @@ begin - \b(module)\b + (?<!^\.|[^.]\.|::)\b(module)\b(?![?!]) beginCaptures 1 diff --git a/Tests/end_distinction.rb b/Tests/end_distinction.rb index 8d79f60..0eb0aac 100644 --- a/Tests/end_distinction.rb +++ b/Tests/end_distinction.rb @@ -21,8 +21,23 @@ class Foo @@module = "mymodule" class_name = "class_name" module_name = "module_name" + self.class.methods + self::class::methods + + def module + nil + end + + def class + nil + end end +Foo.new.module +Foo.new::module +Foo.new.class +Foo.new::class + # ------------------------------------------- # Testarea for classes # -------------------------------------------