Sha256: 285cf5bc9563e3a96620e4e47530fcc4d36b3c85033bd255b910128809135563
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
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 input_file_contents = input_file_contents.collect {|element| element.gsub("#iggggnnnore ","")} 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") and !line.strip.eql?("}#@$") 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nilac-0.0.4.3.9.7.1 | lib/nilac/add_semicolons.rb |
nilac-0.0.4.3.9.7 | lib/nilac/add_semicolons.rb |