Skip to content

Commit 11f8749

Browse files
author
dimo
committed
clearn ruby file
1 parent 6922e6d commit 11f8749

File tree

1 file changed

+1
-85
lines changed
  • interpreter/core/computer/terminal/languages

1 file changed

+1
-85
lines changed
Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
import re
42
from pathlib import Path
53
from .subprocess_language import SubprocessLanguage
@@ -51,18 +49,6 @@ def line_postprocessor(self, line):
5149
return None
5250
if "nil" in line:
5351
return None
54-
55-
# if re.match(r"^(\s*>>>\s*|\s*\.\.\.\s*|\s*>\s*|\s*\+\s*|\s*)$", line):
56-
# return None
57-
# if line.strip().startswith('[1] "') and line.endswith(
58-
# '"'
59-
# ): # For strings, trim quotation marks
60-
# return line[5:-1].strip()
61-
# if line.strip().startswith(
62-
# "[1]"
63-
# ): # Normal R output prefix for non-string outputs
64-
# return line[4:].strip()
65-
6652
return line
6753

6854
def detect_active_line(self, line):
@@ -71,74 +57,4 @@ def detect_active_line(self, line):
7157
return None
7258

7359
def detect_end_of_execution(self, line):
74-
return "##end_of_execution##" in line or "##execution_error##" in line
75-
76-
77-
# import re
78-
79-
# from .subprocess_language import SubprocessLanguage
80-
81-
82-
# class Ruby(SubprocessLanguage):
83-
# file_extension = "rb"
84-
# name = "Ruby"
85-
86-
# def __init__(self):
87-
# super().__init__()
88-
# self.start_cmd = ["ruby"] # Command to start Ruby
89-
90-
# def preprocess_code(self, code):
91-
# """
92-
# Ruby code usually doesn't require preprocessing like R does for line markers,
93-
# but we'll add a similar structure for consistency.
94-
# Wrap in a begin-rescue block for error handling.
95-
# """
96-
97-
# lines = code.split("\n")
98-
# processed_lines = []
99-
100-
# for i, line in enumerate(lines, 1):
101-
# # Add active line print, Ruby uses 'puts' for printing
102-
# processed_lines.append(f'puts "##active_line{i}##"; {line}')
103-
104-
# # Join lines to form the processed code
105-
# processed_code = "\n".join(processed_lines)
106-
107-
# # Wrap in a begin-rescue block for error handling, similar to tryCatch in R
108-
# processed_code = f"""
109-
# begin
110-
# {processed_code}
111-
# rescue => e
112-
# puts "##execution_error##\\n" + e.message
113-
# end
114-
# puts "##end_of_execution##"
115-
# """
116-
# # Track the number of lines for similar reasons as in R, though it might be less necessary in Ruby
117-
# self.code_line_count = len(processed_code.split("\n")) - 1
118-
119-
# return processed_code
120-
121-
# def line_postprocessor(self, line):
122-
# # Similar logic to R for skipping lines if we have a code_line_count
123-
# if hasattr(self, "code_line_count") and self.code_line_count > 0:
124-
# self.code_line_count -= 1
125-
# return None
126-
127-
# # Ruby doesn't use prompts like R's ">", so this can be simplified
128-
# if line.strip() == "":
129-
# return None
130-
# if "##active_line" in line: # Skip active line markers
131-
# return None
132-
133-
# return line
134-
135-
# def detect_active_line(self, line):
136-
# # Similar to R, detect the active line marker
137-
# if "##active_line" in line:
138-
# return int(line.split("##active_line")[1].split("##")[0])
139-
# return None
140-
141-
# def detect_end_of_execution(self, line):
142-
# # Similar to R, detect the end of execution or error markers
143-
# return "##end_of_execution##" in line or "##execution_error##" in line
144-
60+
return "##end_of_execution##" in line or "##execution_error##" in line

0 commit comments

Comments
 (0)