import re

from coalib.bearlib.abstractions.Lint import Lint
from coalib.bears.LocalBear import LocalBear
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY


class RubySyntaxBear(LocalBear, Lint):
    executable = 'ruby'
    arguments = '-wc {filename}'
    output_regex = re.compile(
        r'(?P<file_name>.+?):(?P<line>\d+): (?P<message>'
        r'.*?(?P<severity>error|warning)[,:] [^\r\n]+)\r?\n'
        r'(?:^[^\r\n]+\r?\n^(?P<col>.*?)\^)?')
    use_stderr = True
    severity_map = {
        "warning": RESULT_SEVERITY.NORMAL,
        "error": RESULT_SEVERITY.MAJOR}
    LANGUAGES = "Ruby"

    def run(self, filename, file):
        '''
        Checks the code with `ruby -wc` on each file separately.
        '''
        return self.lint(filename)

@@ -1,15 +1,4 @@
-import re%0A%0A
 from
@@ -34,170 +34,35 @@
 Lint
- import Lint%0Afrom coalib.bears.LocalBear import LocalBear%0Afrom coalib.results.RESULT_SEVERITY import RESULT_SEVERITY%0A%0A%0Aclass RubySyntaxBear(LocalBear, Lint):%0A    
+er import linter%0A%0A%0A@linter(
 exec
@@ -71,110 +71,125 @@
 able
- = 
+=
 'ruby'
+,
 %0A    
-arguments = '-wc %7Bfilename%7D'%0A    output_regex = re.compile(%0A        r'(?P%3Cfile_name%3E
+    use_stdout=False,%0A        use_stderr=True,%0A        output_format='regex',%0A        output_regex=r'
 .+?
-)
 :(?P
@@ -216,23 +216,36 @@
 age%3E
-'%0A        r'.*?
+.*?'%0A                     r'
 (?P%3C
@@ -276,59 +276,58 @@
 ,:%5D 
-%5B%5E%5Cr%5Cn%5D+)%5Cr?%5Cn'%0A        r'(?:%5E%5B%5E%5Cr%5Cn%5D+%5Cr?%5Cn%5E
+%5CS+)%5Cs?'%0A                     r'(?:%5CS+%5Cs
 (?P%3Ccol
+umn
 %3E.*?
@@ -338,281 +338,205 @@
 ?')%0A
-    use_stderr = True%0A    severity_map = %7B%0A        %22warning%22: RESULT_SEVERITY.NORMAL,%0A        %22error%22: RESULT_SEVERITY.MAJOR%7D%0A    LANGUAGES = %22Ruby%22%0A%0A    def run(self, filename, file):%0A        '''%0A        Checks the code with %60ruby -wc%60 on each file separately.%0A        '''
+class RubySyntaxBear:%0A    %22%22%22%0A    Checks the code with %60%60ruby -wc%60%60 on each file separately.%0A    %22%22%22%0A    LANGUAGES = %22Ruby%22%0A%0A    @staticmethod%0A    def create_arguments(filename, file, config_file):
 %0A   
@@ -551,24 +551,21 @@
 urn 
-self.lint(
+'-wc', 
 filename
 )%0A
@@ -562,10 +562,9 @@
 filename
-)
 %0A

Refactor to Linter v2 API