Sha256: 74dd03b6ef5525b558eb5ef215a2991d16eca3124291c0fe6db3f0b227b88506

Contents?: true

Size: 817 Bytes

Versions: 6

Compression:

Stored size: 817 Bytes

Contents

def split_semicolon_seperated_expressions(input_file_contents)

  modified_file_contents = input_file_contents.dup

  input_file_contents.each_with_index do |line, index|

    if line.include?("\"")

      first_index = line.index("\"")

      modified_line = line.sub(line[first_index..line.index("\"", first_index+1)], "--string")

    elsif line.include?("'")

      first_index = line.index("'")

      modified_line = line.sub(line[first_index..line.index("'", first_index+1)], "--string")

    else

      modified_line = line

    end

    if modified_line.include?(";")

      replacement_line = modified_file_contents[index]

      replacement_line = replacement_line.split(";").join("\n\n") + "\n"

      modified_file_contents[index] = replacement_line

    end

  end

  return modified_file_contents

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nilac-0.0.4.3.9.7.1 lib/nilac/split_semicolon_seperated_expressions.rb
nilac-0.0.4.3.9.7 lib/nilac/split_semicolon_seperated_expressions.rb
nilac-0.0.4.3.9.6 lib/nilac/split_semicolon_seperated_expressions.rb
nilac-0.0.4.3.9.5 lib/nilac/split_semicolon_seperated_expressions.rb
nilac-0.0.4.3.9.4 lib/nilac/split_semicolon_seperated_expressions.rb
nilac-0.0.4.3.9.3 lib/nilac/split_semicolon_seperated_expressions.rb