Sha256: 8323495b67df399a04a8dc2c040f8ef49ee13b782b215ba0ecfe8511ed543292
Contents?: true
Size: 995 Bytes
Versions: 3
Compression:
Stored size: 995 Bytes
Contents
def add_semicolons(input_file_contents) def comment(input_string) if input_string.include?("--single_line_comment") true elsif input_string.include?("--multiline_comment") true else false end end reject_regexp = /(function |Euuf |if |else|elsuf|switch |case|while |whaaleskey |for )/ modified_file_contents = input_file_contents.dup input_file_contents.each_with_index do |line,index| if line.index(reject_regexp) == nil if !comment(line) if !line.lstrip.eql?("") if !line.lstrip.eql?("}\n") 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" end end end end end end end modified_file_contents end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nilac-0.0.4.3.9.5 | lib/nilac/add_semicolons.rb |
nilac-0.0.4.3.9.4 | lib/nilac/add_semicolons.rb |
nilac-0.0.4.3.9.3 | lib/nilac/add_semicolons.rb |