Sha256: 122a93287c9ed04b031e2cf13a413741b332770fa3dabd2fa91dbe86c23fa0ae
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
# This is the simplest and most important method on the whole Nilac source code. This protects user written # strings from being overwritten during the compilation def replace_strings(input_string) element = input_string.gsub("==", "equalequal") element = element.gsub("!=", "notequal") element = element.gsub("+=", "plusequal") element = element.gsub("-=", "minusequal") element = element.gsub("*=", "multiequal") element = element.gsub("/=", "divequal") element = element.gsub("%=", "modequal") element = element.gsub("=~", "matchequal") element = element.gsub(">=", "greatequal") input_string = element.gsub("<=", "lessyequal") string_counter = 0 if input_string.count("\"") % 2 == 0 while input_string.include?("\"") string_extract = input_string[input_string.index("\"")..input_string.index("\"",input_string.index("\"")+1)] input_string = input_string.sub(string_extract,"--repstring#{string_counter}") string_counter += 1 end end if input_string.count("'") % 2 == 0 while input_string.include?("'") string_extract = input_string[input_string.index("'")..input_string.index("'",input_string.index("'")+1)] input_string = input_string.sub(string_extract,"--repstring#{string_counter}") string_counter += 1 end end return input_string end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nilac-0.0.4.3.9.7.1 | lib/nilac/replace_strings.rb |
nilac-0.0.4.3.9.7 | lib/nilac/replace_strings.rb |