lib/nilac/add_semicolons.rb in nilac-0.0.4.3.9.7.1 vs lib/nilac/add_semicolons.rb in nilac-0.0.4.3.9.8
- old
+ new
@@ -1,14 +1,14 @@
def add_semicolons(input_file_contents)
def comment(input_string)
- if input_string.include?("--single_line_comment")
+ if input_string.strip.split("--single_line_comment")[0].eql?("")
true
- elsif input_string.include?("--multiline_comment")
+ elsif input_string.strip.split("--multiline_comment")[0].eql?("")
true
else
@@ -36,10 +36,20 @@
if !line.lstrip.eql?("}\n\n")
if line.rstrip[-1] != "[" and line.rstrip[-1] != "{" and line.rstrip[-1] != "," and line.rstrip[-1] != ";"
- modified_file_contents[index] = line.rstrip + ";\n\n"
+ line,comment = line.split("--single_line_comment")
+
+ unless comment.nil? or comment.strip == ""
+
+ modified_file_contents[index] = line.rstrip + "; --single_line_comment#{comment}\n\n"
+
+ else
+
+ modified_file_contents[index] = line.rstrip + ";\n\n"
+
+ end
end
end
\ No newline at end of file